| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Benny Kramek <benny(at)medflyt(dot)com> |
| Cc: | pgsql-performance(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Slow performance with trivial self-joins |
| Date: | 2020-02-03 21:10:20 |
| Message-ID: | 28148.1580764220@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
Benny Kramek <benny(at)medflyt(dot)com> writes:
> I expect the query plan to be identical for both of the below queries (and I
> expect the performance to also be identical).
[ shrug... ] Your expectation is mistaken. There is no code in Postgres
to eliminate useless self-joins. People have been fooling around with
a patch to do so [1], but I'm unsure whether it'll ever get committed,
or whether we even want the feature. It seems not unlikely that the
time wasted trying to identify useless self-joins (in queries where
the optimization doesn't actually apply) would outweigh the win when
it does apply. So there's a limit to how much effort the server should
spend trying to clean up after poorly-written queries.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Arya F | 2020-02-05 17:03:52 | Writing 1100 rows per second |
| Previous Message | Benny Kramek | 2020-02-03 20:38:15 | Slow performance with trivial self-joins |