Hi,

This query is painfully slow ... am I missing something here.

# Time: 111213 16:28:02
# User@Host: root[root] @ localhost []
# Query_time: 64.732636  Lock_time: 0.000188 Rows_sent: 1  Rows_examined: 378402
SET timestamp=1323790082;
SELECT COUNT(*) AS mail, SUM(CASE WHEN virusinfected=0 AND
        nameinfected=0 AND otherinfected=0 AND spam=0 AND
        highspam=0 THEN 1 ELSE 0 END) AS clean_mail, SUM(CASE WHEN
         virusinfected>0 THEN 1 ELSE 0 END) AS virii, SUM(CASE WHEN
          nameinfected>0 AND virusinfected=0 AND otherinfected=0
        AND spam=0 AND highspam=0 THEN 1 ELSE 0 END) AS infected,
        SUM(CASE WHEN otherinfected>0 OR nameinfected>0 AND
        virusinfected=0 AND spam=0 AND highspam=0 THEN 1 ELSE 0 END)
        AS otherinfected, SUM(CASE WHEN spam>0 AND virusinfected=0
        AND nameinfected=0 AND otherinfected=0 AND highspam=0 THEN
        1 ELSE 0 END) AS spam_mail, SUM(CASE WHEN highspam>0 AND
        virusinfected=0 AND nameinfected=0 AND otherinfected=0
        THEN 1 ELSE 0 END) AS high_spam, SUM(size) AS size FROM
        messages WHERE date = '2011-12-13';

I then looked at the messages table and saw there were no index on the
date column.

Have I somehow deleted that index or have it never been there?

mvh
_______________________________________________
Keep Baruwa FREE - http://pledgie.com/campaigns/12056

Reply via email to