On Wed, Jun 1, 2016 at 12:07 AM, sri harsha <sriharsha9...@gmail.com> wrote:
> > Hi, > > In PostgreSQL , does the order in which the criteria is given matter > ?? For example > > Query 1 : Select * from TABLE where a > 5 and b < 10; > > Query 2 : Select * from TABLE where b <10 and a > 5; > > Are query 1 and query 2 the same in PostgreSQL or different ?? If its > different , WHY ?? > > Why are you asking? Do you have any context in which you want to measure "sameness"? I was thinking that pg_stat_statements might treat them differently but the comparison there is object based, not string based, so these should end up with the same hash. If everything is working correctly there will be no observable and persistent difference between executing those exact two queries as far as PostgreSQL is concerned. You might find a difference in the parse tree representation where a > 5 is on the left leaf of a branch in one query but on the right leaf in the other... David J.