Subject Re: [firebird-support] Slow query (unindexed reads)
Author Milan Tomeš - Position
Hi,

I cannot see index on ITEMNUMBER column in metadata you've posted. I see
just ID and ITEMID.

M.

Dne 22.6.2011 11:35, kerryneighbour napsal(a):
>
> 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?
>
>


[Non-text portions of this message have been removed]