MySQL Forums
Forum List  »  Performance

Re: optimizing/indexing date column
Posted by: Chris T
Date: November 15, 2011 10:30PM

Thanks for the advice. I ran explain on the select statement :

mysql> EXPLAIN
-> SELECT *
-> FROM history
-> WHERE pid = '003'
-> AND arrival >= '2008-02-04'
-> AND departure <= '2008-02-04'
-> ;
+----+-------------+---------------------+------+---------------------------+------+---------+------+----------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------------------+------+---------------------------+------+---------+------+----------+-------------+
| 1 | SIMPLE | history | ALL | arrival_idx,departure_idx | NULL | NULL | NULL | 42070352 | Using where |
+----+-------------+---------------------+------+---------------------------+------+---------+------+----------+-------------+
1 row in set (0.00 sec)


I'll definitely read that page though, thanks for the link!



Edited 1 time(s). Last edit at 11/15/2011 10:32PM by Chris T.

Options: ReplyQuote


Subject
Views
Written By
Posted
41719
November 15, 2011 10:06PM
18048
November 15, 2011 10:19PM
Re: optimizing/indexing date column
12837
November 15, 2011 10:30PM
11758
November 15, 2011 11:56PM
9768
November 17, 2011 01:46AM
8105
November 17, 2011 10:14PM
6152
November 18, 2011 12:21AM


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.