Prefetch path performance

Posts   
 
    
Alvaro
User
Posts: 52
Joined: 01-Jun-2004
# Posted on: 29-Jul-2005 17:34:41   

Hello, I discovered a piece of code that fetched an entity collection with some prefetch paths.

The prefetch tree looked something like this:

Root P1 SP1 SP2 P2 SP3 P3 SP4 SP5 P4

Now I can understand that this would generate some rather hedious SELECTs flushed But it was just the way it was done. Some numbers: the query would fetch 200 root entities selected from a total of 13.000. Root - P1 is a 1:1 relationship while the others are m:1 relationships (Pi, SPj, i > 1 all have few tuples, 500 in average).

When I ran it, it seemed to take forever to run rage In fact I stopped it after a while. I modified the query to return just 5 root entities, and it took around 20 minutes to end!!! The windows task manager showed me that the actual query in the database took only a small fraction of that time, 99% of the time was the program taking 99% of CPU time.

I profiled it with the very nice JetBrains dotTrace and most of that time was prefetch path handling time.

So I'm wondering, is this some problem with the prefetch path code, or maybe I'm just not supposed to write that query frowning

salut álvaro.-

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 29-Jul-2005 18:23:02   

Hmm, that should take just a very short time. (3 queries). Did you run the profiler when you ran the query?

(edit) oh wait, what you described isn't a tree-example, but the actual path. That's 10 queries. That shouldn't have to be a problem, though if one node fetches 50,000 objects for example, it's slow.

Frans Bouma | Lead developer LLBLGen Pro