Re: checking for a NULL date in a partitioned table kills performance

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sbob <sbob@quadratum-braccas.com>
Cc: Rui DeSousa <rui.desousa@icloud.com>, "pgsql-performance@lists.postgresql.org" <pgsql-performance@lists.postgresql.org>
Date: 2024-08-23T00:05:19Z
Lists: pgsql-performance
Sbob <sbob@quadratum-braccas.com> writes:
> 29 million of the 32 million rows in the table have NULL for contract_date

[ blink... ]  So your query is selecting at least 29/32nds of the
table, plus however much matches the contract_date > '2022-01-01'
alternative.  I'm not sure how you expect that to be significantly
cheaper than scanning the whole table.

			regards, tom lane