At 01:30 PM 5/5/2004, Daniel Clark wrote:
I wonder if mysql isn't trying to process
  where GMTBase > DATE_SUB(CURRENT_DATE, INTERVAL 2 DAY)

What about doing this date subtracting in PHP and adding the result to the
SQL statement.

Nice try - but it's not the problem. Replacing the equation with a constant does not change the number of rows that will be reviewed. For example,


explain SELECT *
FROM `RuleHistogram`
where GMTBase > '2004-05-03'

+---------------+-------+---------------+---------+---------+--------+--------+-------------+
| table | type | possible_keys | key | key_len | ref | rows | Extra |
+---------------+-------+---------------+---------+---------+--------+--------+-------------+
| RuleHistogram | range | GMTBase | GMTBase | 8 | [NULL] | 954388 | Using where |
+---------------+-------+---------------+---------+---------+--------+--------+-------------+


Anyway, I figured it out. Sorry of the confusion - I think my math is wrong and that's just the number of records it takes to go through 2 days. I'll look for another solution.

Thanks,
_M


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to