From: Tomas Vondra <tomas.vondra@enterprisedb.com> Sent: Monday, August 21, 2023 18:56 To: Jian Guo <gjian@vmware.com>; Hans Buschmann <buschmann@nidsa.net>; pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org> Cc: Zhenghua Lyu <zlyu@vmware.com> Subject: Re: Wrong rows estimations with joins of CTEs slows queries by more than factor 500
!! External Email
On 8/21/23 10:16, Jian Guo wrote: > Hi hackers, > > I found a new approach to fix this issue, which seems better, so I would > like to post another version of the patch here. The origin patch made > the assumption of the values of Vars from CTE must be unique, which > could be very wrong. This patch examines variables for Vars inside CTE, > which avoided the bad assumption, so the results could be much more > accurate. >
No problem with posting a reworked patch to the same thread, but I'll repeat my suggestion to register this in the CF app [1]. The benefit is that people are more likely to notice the patch and also cfbot [2] will run regression tests.