MySQL Forums
Forum List  »  Performance

Re: Optimizing WHERE computations
Posted by: Craig Matthews
Date: June 01, 2005 08:53AM

Thank you Kim and Felix, brilliant. Wonder how the manual misses this!

I have another question about DISTINCT selections on datetime fields.

My SQL: "select count(distinct add_date) from articles;"

There is a composite index on add_date, where add_date is first. The EXPLAIN gives me this:

Type: Index
Possible keys: NULL
Key: idx_date_user_article
Key_len: 60
Ref: NULL
Rows: 800,000 (full table scan)
Where: Using index

The query still takes 4-5 seconds despite "Using index". What am I missing?

Options: ReplyQuote


Subject
Views
Written By
Posted
2242
May 30, 2005 11:48AM
Re: Optimizing WHERE computations
1671
June 01, 2005 08:53AM
1624
June 02, 2005 06:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.