Strangely difference between paging and not

Posts   
 
    
shennig
User
Posts: 48
Joined: 14-Nov-2006
# Posted on: 14-Feb-2007 09:34:59   

hi,

i'm using selfservicing and there i have to load complex structures.


// Buidling Prefetched path with filters
IPrefetchPath oPrefetchPath = new PrefetchPath((int)EntityType.VwArenaEntity);
IPrefetchPathElement oPathArenaGW = 
      oPrefetchPath.Add.VwArenaEntity.PrefetchPathVwArenaGw);
oPathArenaGW.Filter.Add(new FieldCompareRangePredicate(VwArenaGwFields.Lessonnumber, aLessonIds));
FieldCompareValuePredicate oSeriesPredicate2 = new FieldCompareValuePredicate
    (VwArenaGwFields.Seriescode, ComparisonOperator.Equal, strSeriesCode.ToUpper());
oSeriesPredicate2.CaseSensitiveCollation = true;
oPathArenaGW.Filter.AddWithAnd(oSeriesPredicate2);

// Buidling filters
IPredicate oLessonsPredicate = new FieldCompareRangePredicate
    (VwArenaFields.Lessonnumber, aLessonIds);
FieldCompareValuePredicate oSeriesPredicate = new FieldCompareValuePredicate
    (VwArenaFields.Seriescode, ComparisonOperator.Equal, strSeriesCode.ToUpper());
oSeriesPredicate.CaseSensitiveCollation = true;
 IPredicateExpression oConstraint = new PredicateExpression();
oConstraint.Add(oLessonsPredicate);
oConstraint.AddWithAnd(oSeriesPredicate);

IPredicateExpression oSubConstraint = new PredicateExpression();
oSubConstraint.AddWithOr(new FieldCompareValuePredicate(VwArenaFields.Wcshort, 
     ComparisonOperator.NotEqual, "j"));

oConstraint.AddWithAnd(oSubConstraint);

// Loading Data
VwArenaCollection oVocables = new VwArenaCollection();
oVocables.GetMulti(oConstraint, 0, null, null, oPrefetchPath);

VwArena and VwArenaGW are views in firebird, which have a foreign key relation from VwArenaGW to VwArena.

the execution of the GetMulti lasts very, very long, if many VwArenaEntities have to be loaded. already above 40 entities there is nearly no coming back from the execution. but if there are at most 30 entities it is fast.

my idea was to load the entities with paging. only 20-30 by one execution and than loop untill all entities are fetched. this was really faster.

but the strange thing is, if i specify something like this


oVocables.GetMulti(oConstraint, 0, null, null, oPrefetchPath, 1, 1000);

it is also very fast! in this i fetch all entities in one statement by setting the page size high enough. i would have thought that this would be very slow too!

Why is loading all data with paging much more faster than the normal attempt in this case????

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 14-Feb-2007 16:22:32   

Which runtime library version are you using? (Try to download and use the latest)

Check the generated SQL Queries, and execute them directly against the database. And see if there will be any un-explained hangs, or long execution times.

shennig
User
Posts: 48
Joined: 14-Nov-2006
# Posted on: 15-Feb-2007 09:45:54   

the runtime libary version is 2.0.0.061205

i have tried the last sql statement from the trace during the attempt without paging against the database (firebird 2.0) and it fails - never comes back with 100 % workload. its a statement which select data from a complex data view and uses another complex view as a constraint. seems to be a bug in firebird.

in the application the statement fails when more then 30-40 datarows are selected. the reason is, that gen pro until it reaches this border, a alternative statement is created which not uses the above mentioned view select. same holds for the attempt with paging - here it seems that gen pro, always choose the altenative variant without the critical sql statement.

so the problem is not gen pro at all, because the created sql statement is syntactically correct.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 15-Feb-2007 11:32:24   

Thanks for the feedback. The paging query on firebird is pretty simple, but indeed, if the db contains a bug there, there's little we can do. There aren't really other scenario's to page on firebird. Please let me know when/if the Firebird team fixes this.

Frans Bouma | Lead developer LLBLGen Pro