Subject | Re: [firebird-support] Limiting fetched rows doesn't offer much performance benefit |
---|---|
Author | Ivan Prenosil |
Post date | 2006-03-07T18:01:24Z |
> We are trying to query a very large table (millions of records) andSince you use only one field in WHERE clause, adding another field to the index
> only retrieve a few rows using "FIRST n". From our tests, "SELECT
> FIRST 50 * FROM TABLE WHERE FLAG='Y'" doesn't run significantly faster
> than "SELECT * FROM TABLE WHERE FLAG='Y'". The FLAG field is combined
> in a compound index with a unique record number to avoid low selectivity.
can't speed up SELECT statement. Your problem is that either
- there are really too much 'Y' values in FALG field (thus dropping the index should help), or
- you have incorrect order of fields in index' definition, it must be (FLAG, PK), not (PK, FLAG)
Ivan
http://www.volny.cz/iprenosil/interbase/