| From: | shihao zhong <zhong950419(at)gmail(dot)com> |
|---|---|
| To: | rpsalmi(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: BUG #17545: Incorrect selectivity for IS NOT DISTINCT FROM and NULLs |
| Date: | 2026-10-05 04:14:24 |
| Message-ID: | CAGRkXqSkyW7QqriK9v-aH0QjA7s_DhtEfG0RrxEy8jO3_d6LAw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi,
Here is a patch for the estimate. IS NOT DISTINCT FROM is estimated
like "=", so row pairs with NULL on both sides are never counted. The
patch adds the product of the two null fractions to the "=" estimate.
Two tables of 2000 rows, 30% NULL, joined on
x.a IS NOT DISTINCT FROM y.a:
master rows=1400 actual rows=361400
patched rows=361400 actual rows=361400
Thanks,
Shihao
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Count-NULL-pairs-in-IS-NOT-DISTINCT-FROM-selectiv.patch | application/octet-stream | 3.0 KB |
| v1-0002-Add-row-estimate-tests-for-IS-NOT-DISTINCT-FROM.patch | application/octet-stream | 4.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rahul | 2026-10-05 07:19:12 | Re: BUG #17545: Incorrect selectivity for IS NOT DISTINCT FROM and NULLs |
| Previous Message | Michael Paquier | 2026-10-05 03:49:46 | Re: BUG #19730: PostgreSQL `pg_backup_start` accepts newlines in the backup label, producing an unrestorable `backup |