Alright, you were right, 10,000 registers are indeed a breeze!!! Here are my results:
Insertion of 100,000 registers completed in 45911.9 milliseconds. (or 45.9119 seconds) And my miserables ten thousand registers Insertion of 10,000 registers completed in 4336 milliseconds. (or 4.336 seconds) Now, I have another question.. Don't know if post it in another thread.. Question: *********** The table that I am inserting in is being monitored by another process ( a service), but I see the table is locked when inserting and my services is reading the table each 2 seconds. What kind of problem will I have in these scenarios: 1. If I am inserting, will my service be hang? 2. If I am reading the table from my sevice, will my insertion fails? *********** Best regards ----- Original Message ----- From: Markus Zywitza To: [email protected] Sent: Friday, June 19, 2009 3:06 PM Subject: Re: Active Record Bulk Insert Why? In short: NH needs to assign an ID to each object once saved. With identity the only option is to actually insert the object immediately to get the ID, because it is server generated on insert. Most others can be assigned by NH directly without going to the DB. But: 10.000 is a breeze, we had someone here not too long ago who had to insert 18 Mio. rows in a batch. So unless you are experiencing utterly problems with your app, just use StatelessSession for the import and ignore the batch size. -Markus 2009/6/19 Cesar Sanz <[email protected]> Oh my.. And why is that? I guess I will need to utilize the bulk insert provided by microsoft.. :( ----- Original Message ----- From: Markus Zywitza To: [email protected] Sent: Friday, June 19, 2009 9:55 AM Subject: Re: Active Record Bulk Insert That's the only one that doesn't function... -Markus 2009/6/19 Cesar Sanz <[email protected]> I am using a autoincremental primary key. Will this work in this case? ----- Original Message ----- From: "Jason Meckley" <[email protected]> To: "Castle Project Users" <[email protected]> Sent: Friday, June 19, 2009 7:38 AM Subject: Re: Active Record Bulk Insert ado.net batching only works in certain scenarios. for example if you table uses identity for the PK batching has no (or negative) effect. here are 2 posts on the subject http://fabiomaulo.blogspot.com/2009/02/nh210-new-generators.html http://fabiomaulo.blogspot.com/2009/02/nh210-generators-behavior-explained.html On Jun 19, 3:48 am, Markus Zywitza <[email protected]> wrote: > 2009/6/18 Cesar Sanz <[email protected]> > > > So, how do StateLess sessions helps in this case, how does it works? > > It disables 1st-level-cache, so that these objects are not tracked in the > application for changes, speeding up the insertion process. > > > > > I have read the link you provided, but i see this <property name=" > > adonet.batch_size">100</property> > > If I am using AR, I mean decoring my clases with properties (not using > > xml > > mapping) where do I must to put this sentence? > > Into the configuration: > <add key="adonet.batch_size" value="100" /> > next to the other <add>-tags. > > > > > How do I insert records in a batch, but being able to insert inmediatly > > if desired? > > AFAIK you just have to call SaveAndFlush() to immediately send the queries > collected sofar to the DB. > > -Markus --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
