Hi Jeff,
Thanks for looking at the patch.
On 6 January 2018 at 10:34, Jeff Janes <jeff.janes@gmail.com> wrote:
> Couldn't the Unique node be removed entirely? If k is a primary key, you
> can't have duplicates in need of removal.
It probably could be, if there were no joins, but any join could
duplicate those rows, so we'd only be able to do that if there were no
joins, and I'm not sure we'd want to special case that. It seems just
too naive to be taken seriously. We could do a lot better...
> Or would that be a subject for a different patch?
Yeah, I'd rather do that fix properly, and do have ideas on how to,
just it's a lot more work (basically testing if the joins can
duplicate rows or not (unique joins++)).
> I think remove_functionally_dependant_groupclauses should have a more
> generic name, like remove_functionally_dependant_clauses.
It's been a while since I looked at this. I remember thinking
something similar at the time but I must have not changed it.
I'll look again and post an updated patch.
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services