Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Generated code> Insert Performance Issue
 

Pages: 1
Generated code
Insert Performance Issue
Page:1/1 

  Print all messages in this thread  
Poster Message
Puromtec
User



Location:
MD
Joined on:
22-Jun-2005 16:38:52
Posted:
48 posts
# Posted on: 03-Oct-2006 20:21:44.  
llblgen pro 1.0.2005.1 Final
Oracle 10G Express
.net 1.1


I am having performance issues with importing data into database.

The process imports many 1000's of records. Each individual record could have a corresponding child row that belongs to 1 of 10 child tables.

In llbl speak: each one of the parent entities has one child collection that receives one entity only.

I am using the UnitOfWork object to speed things up. However, LLBL continues to hit the database the whole time between commit calls.

There doesn't seem to be a way to stop db activity. When I "Add" entities to the colletions, database calls are from GetMulti, etc. To fix that, I set DoNotPerformAddIfPresent = false. That makes adding to collections faster. This doesn't help me overall because for some reason setting this flag to false llbl must call get_childCollection to access the property via parent entity and that causes a database query. I have to set DoNotPerf.. = false for every parent row, which slows things down.

Bottom line, I don't want any database activity until i call unitOfWork.Commit.

I'd appreciate any replies.

-Thanks
  Top
Puromtec
User



Location:
MD
Joined on:
22-Jun-2005 16:38:52
Posted:
48 posts
# Posted on: 03-Oct-2006 21:24:47.  
After looking around in the generated code, I found that the collection refetches if the following if statement is true.

if( ( !_alreadyFetchedEngExcursion || forceFetch || _alwaysFetchEngExcursion) && !base.IsSerializing && !base.IsDeserializing && !EntityCollectionBase.InDesignMode)
{
// LLBL gets the collection from database
}


I've come up with a solution, but a dirty one. If it is a bad idea, let me know.

Solution:

Prior to setting the DoNotPerformAddIfNotPresent property and any "Add", set this thing to true.

EntityCollectionBase.InDesignMode = true;            

Afterwards, set it back to false.

This is the only part of the above if clause that is public.


  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
13658 posts
# Posted on: 04-Oct-2006 08:51:00.  
Please provide more setails about your setup, and whether you are using SelfServicing or Adapter. And it would be of much help if you post real code (especially of your UOW usage and where exactly does it hit the database)

Please follow the guidelines in the following thread:
http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7725
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
34494 posts
# Posted on: 04-Oct-2006 10:58:44.  
You're triggering lazy loading.

If you do:
myCustomer.Orders.Add(myOrder);

you'll load myCustomer.Orders first, then add myOrder to it.

Instead do:
myOrder.Customer = myCustomer;

Regular Smiley

Tip: data-import is slower if you do it all in 1 transaction. So if you save 1000s of entities as an import, and you do that in a uow, be aware that a transaction will be used which could slow things down a bit, especially if the transaction log of your db is small.


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Puromtec
User



Location:
MD
Joined on:
22-Jun-2005 16:38:52
Posted:
48 posts
# Posted on: 04-Oct-2006 15:03:42.  
Thanks Otis. That is definitely a better solution.

With regard to data-import tuning, I found that 75 inserts was best for my transaction size.

I'll post code next time.

  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.