Subject Re: Firebird 2.0 Indexing
Author Svein Erling Tysvær
> TABLE LAYOUT:
>
> SKU VARCHAR(16) (PK)
> STORE_NO INTEGER (PK) (this field also has an individual index on
> it)
> COST DECIMAL(15, 4)
> PRICE DECIMAL(15, 4)
> .
> .
> .
> (15 other fields are also in this table)
>
> Primary Key Stats (PK_SKU_STORE). 0.0000004474044
> Store_No Key Stats (IDX_STORE). 0.5000000000000

Drop the index on Store_No, the selectivity is too poor for the index
to be useful (your GROUP BY query should execute somewhat faster
without this index, probably equal to your DISTINCT query).

And the query I suggested with another table having only STORE and
using EXISTS into your structure should be considerably faster than
your current queries (I interpret the IDX_STORE index as there only
being two stores, is this correct?).

Set