I feel strongly that eliminating the entire DISTINCT or GROUP BY clause (when
there are no aggs) is an important optimization, especially when the
incremental cost to test for it is so tiny. I'm happy to submit that as a
separate thread.
My goal here was to move the original proposal along and contribute a little
something back to the community in the process. DISTINCT optimization is
currently quite poor compared to the leading commercial RDBMS alternatives, and
doing unnecessary DISTINCT in the single-table case is an example of that.
There are other missing DISTINCT optimizations.
I'll explore a proper way to test that it's in the single-relation case, and
will post a separate thread for the 'remove unnecessary DISTINCT' optimization.
Cheers,
/Jim
On 8/23/18, 11:12 PM, "David Rowley" <[email protected]> wrote:
You might be confusing #1 and #2. My concern is with #2. The existing
GROUP BY clause optimisation is almost identical to #1. I just wanted
to also apply it to the DISTINCT clause.
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services