Subject | Index Question |
---|---|
Author | Alexander Tabakov |
Post date | 2003-12-12T10:12:47Z |
Hi guys,
I have a table TBL_PAYMENT. There is a compound index defined on
(PAYMENT_ID, SERVICE_ID). When performing a query using SERVICE_ID
in the WHERE clause execution time is about 30 ms which is perfectly OK.
But, after changing the index to be (SERVICE_ID, PAYMENT_ID) execution
time of the same query became: 3 minutes and 30 sec.
Both times the plan was one and the same (I mean the optimizer choose
the same index to use).
I use Firebird 1.0.3 on Win2K box.
Any ideas about the difference in execution speed?
Are there any rules on field ordering in a compound key?
--
Best regards,
Alexander mailto:saho@...
I have a table TBL_PAYMENT. There is a compound index defined on
(PAYMENT_ID, SERVICE_ID). When performing a query using SERVICE_ID
in the WHERE clause execution time is about 30 ms which is perfectly OK.
But, after changing the index to be (SERVICE_ID, PAYMENT_ID) execution
time of the same query became: 3 minutes and 30 sec.
Both times the plan was one and the same (I mean the optimizer choose
the same index to use).
I use Firebird 1.0.3 on Win2K box.
Any ideas about the difference in execution speed?
Are there any rules on field ordering in a compound key?
--
Best regards,
Alexander mailto:saho@...