From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Peter Koukoulis <pkoukoulis(at)gmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: hard parse? |
Date: | 2017-09-21 15:10:04 |
Message-ID: | CAKFQuwaCCRBWYbwdd9-NqsSnueeveBK=_yh8vr=LKD+1djGyJg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Sep 21, 2017 at 5:48 AM, Peter Koukoulis <pkoukoulis(at)gmail(dot)com>
wrote:
> Hi
>
> I have a query where a filter would always be negative, how many steps,
> out these:
>
> - parsing and syntax check
> - semantic analysis
> - transformation process (query rewrite based on system or
> user-defined rules)
> - query optimization
> - execution
>
> would be performed or not? Also, where in the documentation can I found
> out which of the above phases would be performed?
>
> For example, for a query such as the following:
>
> select x,y from test1 where 1=0;
>
>
I'm inferring behavior here but...
All of them. You are still going to get a result set with zero records
and the correct column structure. i.e., "Execution". None of the other
stuff can be skipped in getting to engine to that point. With a "always
false" predicate and that simple of a query structure most of the other
stuff, including execution, is probably performed is seemingly zero time
but it still has to work through that step of the process - if nothing else
than to move through an if-branch to decide that nothing material needs to
be done.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-09-21 15:50:55 | Re: hard parse? |
Previous Message | Merlin Moncure | 2017-09-21 13:54:56 | Re: a JOIN to a VIEW seems slow |