List:General Discussion« Previous MessageNext Message »
From:Glyn Astill Date:March 19 2014 9:49am
Subject:Re: Precedence in WHERE clauses.
View as plain text  

> From: Christophe <tech@stripped>
> To: mysql@stripped
> Cc: 
> Sent: Tuesday, 18 March 2014, 19:10
> Subject: Precedence in WHERE clauses.
> 
> 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.
> 
> 

What is the output from explain?

EXPLAIN SELECT * FROM Status WHERE DWProcessed = 0 AND PreviousStatus NOT IN
('PENDING', 'ACCEPTED') AND SubscribeDate < DATE_SUB(NOW(), INTERVAL 24 HOUR);
Thread
Precedence in WHERE clauses.Christophe18 Mar 2014
  • Re: Precedence in WHERE clauses.Michael Dykman18 Mar 2014
    • Re: Precedence in WHERE clauses.Christophe20 Mar 2014
      • Re: Precedence in WHERE clauses.Roy Lyseng20 Mar 2014
  • Re: Precedence in WHERE clauses.Glyn Astill19 Mar 2014
  • Re: Precedence in WHERE clauses.Morgan Tocker19 Mar 2014
    • Re: Precedence in WHERE clauses.Reindl Harald19 Mar 2014
      • Re: Precedence in WHERE clauses.Morgan Tocker19 Mar 2014
        • Re: Precedence in WHERE clauses.Reindl Harald19 Mar 2014
          • Re: Precedence in WHERE clauses.Morgan Tocker19 Mar 2014
            • Re: Precedence in WHERE clauses.Christophe20 Mar 2014
              • Re: Precedence in WHERE clauses.Christophe23 Mar 2014
                • Re: Precedence in WHERE clauses.shawn l.green25 Mar 2014
    • Re: Precedence in WHERE clauses.Mogens Melander19 Mar 2014
      • Re: Precedence in WHERE clauses.shawn l.green20 Mar 2014