I'm seeing slow performance in a SELECT that uses a compound index, i.e.
SELECT count(*), apples from table WHERE Apples in (select Type from appletypes).
The table is indexed thusly:
CREATE UNIQUE INDEX table_allfruit ON table (Apples, Peaches, Grapes)
Could either the indexing or the WHERE be improved here?
I.e. would it help to have an additional standalone index on Apples? I thought if Apples was the start of a compound index it would perform like a single index.
Or is it my IN that's causing the slowness?
Thanks for any thoughts you may have.
TB
SELECT count(*), apples from table WHERE Apples in (select Type from appletypes).
The table is indexed thusly:
CREATE UNIQUE INDEX table_allfruit ON table (Apples, Peaches, Grapes)
Could either the indexing or the WHERE be improved here?
I.e. would it help to have an additional standalone index on Apples? I thought if Apples was the start of a compound index it would perform like a single index.
Or is it my IN that's causing the slowness?
Thanks for any thoughts you may have.
TB