Subject | Slow query (unindexed reads) |
---|---|
Author | kerryneighbour |
Post date | 2011-06-22T09:35:05Z |
I am using FB 2.5 in Windows.
I am trying to optimize some rather slow queries. Some (most?) indexes do not seem to be working.
For example - I have a query that I have simplified to
SELECT ID,ITEMNUMBER,ITEMDESC FROM MYTABLE ORDER BY ITEMNUMBER
I run this on a table of about 30,000 records. It takes ages, and IBExpert tells me that all the reads are UNINDEXED.
There is a primary index on ID, and an index on the sort field
ALTER TABLE LOCATIONITEMS ADD CONSTRAINT PK_LOCATIONITEMS PRIMARY KEY (ID);
CREATE INDEX LOCATIONITEMS_ITEMID ON LOCATIONITEMS (ITEMID);
This happens on many of my queries - I only show this one as it is very simple.
The plan is PLAN SORT (SORT ((LOCATIONITEMS NATURAL)))
Can anyone see why the index is not being used?
I am trying to optimize some rather slow queries. Some (most?) indexes do not seem to be working.
For example - I have a query that I have simplified to
SELECT ID,ITEMNUMBER,ITEMDESC FROM MYTABLE ORDER BY ITEMNUMBER
I run this on a table of about 30,000 records. It takes ages, and IBExpert tells me that all the reads are UNINDEXED.
There is a primary index on ID, and an index on the sort field
ALTER TABLE LOCATIONITEMS ADD CONSTRAINT PK_LOCATIONITEMS PRIMARY KEY (ID);
CREATE INDEX LOCATIONITEMS_ITEMID ON LOCATIONITEMS (ITEMID);
This happens on many of my queries - I only show this one as it is very simple.
The plan is PLAN SORT (SORT ((LOCATIONITEMS NATURAL)))
Can anyone see why the index is not being used?