Subject | Re: Query optimization again |
---|---|
Author | Svein Erling Tysvær |
Post date | 2005-02-22T13:08:15Z |
> Changing from exact list of criteria to a "like 'xy%'" list andPlease consider using STARTING as well. As long as you hardcode 'xy%'
> denormalizing brings down execution time from almost 3 minutes to 18
> seconds. Seems like I'll have to consider a modification to my SQL
> generator so it supports that kind of query. *sigh*
it doesn't make any difference (well, off the top of my head I don't
remember whether one of them is case sensitive and the other not), but
once you start using parametres, then STARTING can use an index
whereas LIKE cannot.
If the criteria is somewhat fixed, you could also add another field or
table and use that to group the records. Using
JOIN KJELLGROUPS ON KJELLGROUPS.FIELD = CHILD.FIELD
WHERE KJELLGROUPS.CurrentGroup = :Query1Value
sounds much more tempting to me than ORing 283 values - regardless of
speed (speedwise, I think you could benefit from having one such
indexed field (CurrentGroup, PK) in the main table, but doubt anything
could be gained with a lookup table).
Set