Subject | Re: [firebird-support] Slow select min() |
---|---|
Author | Dmitry Yemanov |
Post date | 2009-07-29T05:15:58Z |
Kirill Nesterenko wrote:
engine scans the whole index PK_STAT and trying the appropriate record
IDs against the bitmap created as a result of the range index
(STAT_USER_ID) scan. I suspect the two records with USER_ID = 100 have
quite large ID values (i.e. they're located near the end of the index),
thus you notice the bad performance.
Dmitry
> Also, I noticed that default plan isAn obvious example of a bad optimizer choice. With the default plan, the
> "PLAN (stat ORDER PK_STAT INDEX (STAT_USER_ID))".
> But if I change it to the "PLAN (stat INDEX (STAT_USER_ID))" - query runs
> immediately..
engine scans the whole index PK_STAT and trying the appropriate record
IDs against the bitmap created as a result of the range index
(STAT_USER_ID) scan. I suspect the two records with USER_ID = 100 have
quite large ID values (i.e. they're located near the end of the index),
thus you notice the bad performance.
Dmitry