Link to home
Start Free TrialLog in
Avatar of Zipbang
Zipbang

asked on

Slow simple MySQL query (date range)

This is a very simple table with 6 columns.  Currently the table has more than 4 million records.  This is the query:


SELECT * FROM chamber_ghst
WHERE chamberid='Ambient' and
actiondate BETWEEN '2013/06/12 12:06:00' and '2013/06/13 12:06:00'
ORDER BY actiondate ASC



This query results in 288 records.  It takes about 16 seconds.  I just don't see why or understand how I can optimize this.
SOLUTION
Avatar of David Kroll
David Kroll
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Tomas Helgi Johannsson
Tomas Helgi Johannsson
Flag of Iceland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
NEVER EVER USE SELECT *  ALWAYS USE LIMIT

But that said, there are some really good articles here at EE about MySQL performance.  Example here:
https://www.experts-exchange.com/Database/MySQL/A_1250-3-Ways-to-Speed-Up-MySQL.html