MySQL Forums
Forum List  »  Performance

Re: Index and date functions
Posted by: Aurelien PANIZZA
Date: February 04, 2013 03:33AM

Hi,

Thank you for your reply.

The table (InnoDB) contains 4 millions rows and sizes 1.7GB on disk.
Only 1200 rows have a date within the last 30 days.

An explain on the query returns :

Type = ALL
Possible_keys = NULL
Key = NULL
Key_len = NULL
ref = NULL
row = 4200000
Extra = Using where

Apparently MySQL doesn't use the index when using any date functions.

In order to get around this problem, I'm seeking how I could use a fixe date in the where condition, so that mysql doesn't have to calculate the date function for each row. Maybe if using a stored procedure which calculte the date only once and then pass it as a parameter to the query ?

Options: ReplyQuote


Subject
Views
Written By
Posted
3297
January 30, 2013 10:30AM
1414
January 31, 2013 10:22PM
Re: Index and date functions
1363
February 04, 2013 03:33AM
1171
February 04, 2013 10:45AM


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.