Re: Incorrect selectivity estimates for NOT on nullable boolean columns

From: solai v <solai(dot)cdac(at)gmail(dot)com>
To: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
Cc: "pierre(dot)forstmann(at)gmail(dot)com" <pierre(dot)forstmann(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Incorrect selectivity estimates for NOT on nullable boolean columns
Date: 2026-11-03 04:55:54
Message-ID: CAF0whufbQCWPYc_90H8777_dXfo6tVG2v=LOZiDCjQGR7QD8jQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I have applied the proposed patch and tested the issue related to incorrect
selectivity estimates for NOT on nullable Boolean columns.

I first reproduced the issue before applying the patch. The test table
contained 10,000 rows (7,000 NULL, 2,000 TRUE, and 1,000 FALSE values).

Before applying the patch:

-

Estimated rows: 8,000
-

Actual rows: 1,000

After applying the patch, I rebuilt and tested PostgreSQL using the same
data and query.

After applying the patch:

-

Estimated rows: 1,000
-

Actual rows: 1,000
-

Rows removed by filter: 9,000
-

Execution time: 0.803 ms

I also tested cases with no NULL values, only NULL values, and without
ANALYZE statistics.

All regression tests passed, and git diff --check reported no issues.

The estimated row count now matches the actual row count in the main test
case.

Regards
solai

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Raja Sai pranav 2026-11-03 04:56:32 Re: Re: Assertion failure in WAL summarizer
Previous Message Ajin Cherian 2026-11-03 04:25:33 Re: [PATCH] Preserve replication origin OIDs in pg_upgrade