Re: Slow performance with trivial self-joins

2020-02-03 Thread Tom Lane
Benny Kramek 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 pat

Slow performance with trivial self-joins

2020-02-03 Thread Benny Kramek
Hello, I am experiencing slow performance when joining a table against itself on its primary key column. I expect the query plan to be identical for both of the below queries (and I expect the performance to also be identical). But the second one is much slower: The FAST QUERY has a planning tim