Subject RE: [firebird-support] Slow query because an index is not picked up during sort
Author Svein Erling Tysvær
>Svein, the selectivity of source_id is 0.000446 and commit_number is 0.000001. So, it is not clear
>why FB is not using index on commit_number to filter AND sort on.

I'd agree, Alec, if your where clause had involved "PHYSICAL_COPY."COMMIT_NUMBER" = 10000000", but >= and = are two very different operators. I'd be shocked if Firebird hadn't come up with the best plan if you'd compared for equality. The selectivity of >=, however, certainly isn't 0.000001 for commit_number, but more like 0.5.

Set