From: | David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> |
---|---|
To: | Jim Finnerty <jfinnert(at)amazon(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Removing useless DISTINCT clauses |
Date: | 2018-03-23 21:52:56 |
Message-ID: | CAKJS1f8AnhCdLcXesLGbUUjGx2+QETHLeR7q-KBriuR-Lm8maQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 24 March 2018 at 01:42, Jim Finnerty <jfinnert(at)amazon(dot)com> wrote:
> Distinctness can also be preserved across joins, so if you have a 'snowflake
> query' type join, where all the joins are to a unique key, then the
> distinctness of the other side of the join is preserved. For example, a
> SELECT DISTINCT * FROM fact_table ... that joins from each column in its
> compound primary key to a unique key of another (dimension) table would
> remain distinct, and so you could drop the DISTINCT from the query.
I'm aware. It is something I'm interested in but would require several
orders of magnitude more work than what I've done for this patch. You
may have noticed the other work I did a while back to detect if joins
cause row duplicate or not, so it's certainly something I've thought
about.
If Amazon would like to sponsor work in this area then please see [1].
It certainly would be great to see that happen.
[1] https://wiki.postgresql.org/wiki/How_to_sponsor_a_feature
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | legrand legrand | 2018-03-23 22:44:26 | Re: Sample values for pg_stat_statements |
Previous Message | David Rowley | 2018-03-23 21:46:06 | Re: Removing useless DISTINCT clauses |