On 24 August 2018 at 03:29, Finnerty, Jim <jfinn...@amazon.com> wrote: > Thank you Álvaro. Here's the distinct_opt_v7 patch.
Determining if there's just 1 base relation by checking the length the rtable is not a good way. If you want to see why, try creating a primary key on a partitioned table. My personal opinion of only being able to completely remove the DISTINCT when there's a single item in the rtable (or a single base table) is that it's just too poor to bother with. I think such a solution is best left to another patch and it should be much more complete and be able to track the unique properties through joins. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services