On 16/05/2026 12:07, PG Bug reporting form wrote:
> That strongly suggests the extended expression MCV stats are still not being
> matched for equivalent predicates on the nullable side of the outer join.
The query explain tells the whole story:
Nested Loop Left Join
Filter: ((COALESCE(mod(m.a, 20), 1) = 1) AND (COALESCE(mod(m.b, 10), 1) = 1)
AND (COALESCE(mod(m.c, 5), 1) = 1))
-> Result
-> Seq Scan on mcv_bug m
As you can see, this clause is a JOIN clause. Your coalesce filter applies to
the result of the join. But m.a,m.b, and m.c might be changed (nullified) in
this join. So, your extended statistic isn't applicable here. To be relevant, it
should calculate the number of not-matched LHS tuples and account for them.
In your case, the ON clause is 'true', so all tuples will be matched. It is a
degenerate case and might potentially be improved, but it doesn't look like a bug.
--
regards, Andrei Lepikhov,
pgEdge