From: | Alexander Kuzmenkov <a(dot)kuzmenkov(at)postgrespro(dot)ru> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Mark Dilger <hornschnorter(at)gmail(dot)com> |
Subject: | Re: "SELECT ... FROM DUAL" is not quite as silly as it appears |
Date: | 2018-11-29 12:08:31 |
Message-ID: | 6d51c9bb-ccc6-92fd-b6ac-05f0d5546d70@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I was also looking at this patch, here are some things I noticed:
In remove_useless_results_recurse where it processes JOIN_SEMI there is
this comment:
* However, we can't simplify if there are PHVs to
evaluate at
* the RTE_RESULT ... but that's impossible isn't it?
Is that impossible because the RHS of semi join can't be used above it?
Let's write this down. There is similar code above for JOIN_LEFT and it
does have to check for PHVs, so a comment that clarifies the reasons for
the difference would help.
Also around there:
if ((varno = is_result_ref(root, j->rarg)) != 0 &&
I'd expect a function that starts with "is_" to return a bool, so this
catches the eye. Maybe varno = get_result_relid()?
Looking at the coverage report of regression tests, most of the new code
is covered except for the aforementioned simplification of JOIN_LEFT and
JOIN_RIGHT, but it's probably not worth adding a special test. I checked
these cases manually and they work OK.
I also repeated the benchmark with trivial select and can confirm that
there is no change in performance.
--
Alexander Kuzmenkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
From | Date | Subject | |
---|---|---|---|
Next Message | Dmitry Dolgov | 2018-11-29 12:10:57 | Re: [HACKERS] Weaker shmem interlock w/o postmaster.pid |
Previous Message | David Rowley | 2018-11-29 10:54:58 | Re: Planning time of Generic plan for a table partitioned into a lot |