Consider making a separate archive table and live table. Looking at that query, I doubt any other index will help.

Sent from my iPhone

On Sep 15, 2009, at 17:07, Andrew Bruno <andrew.br...@gmail.com> wrote:

Hello,

I have a query that used to take 10secs to run, i.e.

select * from Message m where
m.m essageId='<7997716ed1af3d47a35d74fa2cb6109202553...@somedomain.com>'
and m.id != 933927 and m.archived=1

The Message table has around one million rows.

I added the following index

CREATE INDEX IDX_Message_MessageId ON ExchangeSync.Message (messageId)

and now it takes 5secs.

Is there anything else I can do?

Should I add an index on the boolean "archived" column too?

Any performance hints appreciated.

Thanks
Andrew

Reply via email to