There is actually another separate issue here apart from that the planner
obviously choosing the wrong plan as originally described in my last message, a
plan it knows to be more expensive based on cost estimates.
Take a look at the way the filter condition is treated differently when
estimatin
dth=332) (actual time=0.003..0.003 rows=1 loops=15521)
Index Cond: ("ID" = c.item)
Planning time: 0.223 ms
Execution time: 526.203 ms
== Original ======
From: David Rowley
To: Benjamin Coutu
Date: Sun, 29 Oct 2017 12:46:42 +0100
Subject: Re: [PERFORM] Cheaper s
Hello everyone,
Please consider the following three semantically equivalent, but differently
written queries:
Query A:
SELECT * FROM items a INNER JOIN (
SELECT item, sum(amount) stock FROM stocktransactions GROUP BY item HAVING
sum(amount) >= 1
) b ON b.item = a. "ID"
Query B:
SELECT * FR