Adjust ndistinct for eqjoinsel

From: Zhenghua Lyu <zlyu(at)vmware(dot)com>
To: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Adjust ndistinct for eqjoinsel
Date: 2022-07-15 14:06:54
Message-ID: CO6PR05MB750605D9F88AAFFB95658BABB58B9@CO6PR05MB7506.namprd05.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
I run TPC-DS benchmark for Postgres and find the join size estimation has several problems.
For example, Ndistinct is key to join selectivity's estimation, this value does not take restrictions
of the rel, I hit some cases in the function eqjoinsel, nd is much larger than vardata.rel->rows.

Accurate estimation need good math model that considering dependency of join var and vars in restriction.
But at least, indistinct should not be greater than the number of rows.

See the attached patch to adjust nd in eqjoinsel.

Best,
Zhenghua Lyu

Attachment Content-Type Size
0001-Adjust-ndistinct-with-nrows-in-the-rel-when-estimati.patch application/octet-stream 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2022-07-15 14:33:17 Re: Doc about how to set max_wal_senders when setting minimal wal_level
Previous Message Tom Lane 2022-07-15 14:03:24 Re: Allowing REINDEX to have an optional name