Subject | index and statistics |
---|---|
Author | scharloi |
Post date | 2005-07-29T13:49:03Z |
Hi,
I do the following :
- Create tables with primary and foreign keys and index.
- Insert all data
Next I execute a select statement (join 5 tables on foreign key). The
spent time is about 0.10 s.
Next do a "SET STATISTICS" on all index.
Execute the same statement and I time the response to 0.64 s.
Then if i deactivate index on varchar column, i time the response to
0.11 ms.
I read in the "Firebird Data Definition" book :
<<For tables where the number of duplicate values in indexed columns
radically increases or decreases, periodically recomputing index
selectivity can improve performance. SET STATISTICS recomputes the
selectivity of an index.>>
My question is : Why the performance of a query can decrease after
recomputing index selectivity ?
I do the following :
- Create tables with primary and foreign keys and index.
- Insert all data
Next I execute a select statement (join 5 tables on foreign key). The
spent time is about 0.10 s.
Next do a "SET STATISTICS" on all index.
Execute the same statement and I time the response to 0.64 s.
Then if i deactivate index on varchar column, i time the response to
0.11 ms.
I read in the "Firebird Data Definition" book :
<<For tables where the number of duplicate values in indexed columns
radically increases or decreases, periodically recomputing index
selectivity can improve performance. SET STATISTICS recomputes the
selectivity of an index.>>
My question is : Why the performance of a query can decrease after
recomputing index selectivity ?