From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | sri harsha <sriharsha9992(at)gmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Change in order of criteria - reg |
Date: | 2016-06-03 19:03:39 |
Message-ID: | CAKFQuwYcB6EwtAYpMWE=faEM1AeGTM39vwRGtTZhyR=9rjK3MQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On Wed, Jun 1, 2016 at 12:07 AM, sri harsha <sriharsha9992(at)gmail(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Leonardo M. Ramé | 2016-06-03 19:08:07 | Londiste3 - Ubuntu 16.04 - Postgresql 9.3 |
Previous Message | Andres Freund | 2016-06-03 18:12:13 | Re: [GENERAL] Permission Denied Error on pg_xlog/RECOVERYXLOG file |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2016-06-03 19:17:06 | Re: Perf Benchmarking and regression. |
Previous Message | David Fetter | 2016-06-03 19:02:18 | Negators for operators |