Hi all,

I would like to create an index to speed up the following query:

SELECT Account, Status, count(*) From MessageStatus WHERE sentDate >
'(variable)' AND sentDate < '(variable)' GROUP BY Account,Status ORDER BY
Account

sentDate is a timestamp(14), Account and Status are both varchars.

The table also contains another couple of columns and already has an index
on sentDate.

So two questions:

1. What index should I create (my original guess was just sentDate, but now
I am thinking sentDate(8),Account,Status)

2. Does the fact that I created the sentDate index, which is not being used
as it does not speed up the query, detriment the performance significantly?
Should I remove that index as it is not being used?

The table currently has around 800,000 entries in it and grows by between
4,000 and 100,000 entries a day.

Entries are deleted once they are 6 months old.

Many thanks,

Ben


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to