My advice to you is to make use of the EXPLAIN facility which porovides the most accurate information about how MySQL is going to treat your query.
Also, as you currently have it, the expression DATE_SUB(NOW(), INTERVAL 24 is going to be executed once for every single candidate row. I would suggest you temporarily memoize that like so: select into DATE_SUB(NOW(), INTERVAL 24 HOUR) INTO @yesterday ; SELECT * FROM Status WHERE DWProcessed = 0 AND PreviousStatus NOT IN ('PENDING', 'ACCEPTED') AND SubscribeDate < @yesterday); On Tue, Mar 18, 2014 at 3:10 PM, Christophe <t...@stuxnet.org> wrote: > Hi list, > > I'd like to get your advice about precedence in where clauses in MySQL > (5.0.51, and 5.1.66 in this case / from lenny and squeeze Debian > packages ). > > Considering the following simple query : > > SELECT * FROM Status WHERE DWProcessed = 0 AND PreviousStatus NOT IN > ('PENDING', 'ACCEPTED') AND SubscribeDate < DATE_SUB(NOW(), INTERVAL 24 > HOUR); > > Which of these filters are processed first ? > > I'd like the first filter (DWProcessed / Lowest cardinality and indexed) > being processed first, but I can't really find any useful information > about this . > > Is there any performance impact on query processing, about the order of > WHERE clauses ? > > Regards, > Christophe. > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql > -- - michael dykman - mdyk...@gmail.com May the Source be with you. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql