Tests for extended MCV stats compatibility with multi-filter conditions on a single column

From: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Tests for extended MCV stats compatibility with multi-filter conditions on a single column
Date: 2025-02-06 22:03:48
Message-ID: e4959e6b-1968-4ad0-99c9-acfe3c1c1e29@tantorlabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

When a query uses multiple filters on a single column in the WHERE
clause, and extended mcv statistics are applied on the column, the
optimizer should take each clause into account when estimating
selectivity. For example, this could be (A = 0 OR A = 1), (A BETWEEN 0
AND 5), or (A > 0 AND A <= 5). Such range conditions are quite common in
practice. However, I did not find any tests covering these scenarios in
the stats_ext.sql regression test.

I propose adding tests for these cases. This will make the behavior of
MCV extended statistics more clear to users and developers.

Any feedback, suggestions, or additions to the tests are welcome and
appreciated.

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC.

Attachment Content-Type Size
v1-0001-Add-tests-for-extended-MCV-statistics.patch text/x-patch 3.6 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-02-06 22:11:25 Re: Test to dump and restore objects left behind by regression
Previous Message Daniel Gustafsson 2025-02-06 22:02:43 Re: [PoC] Federated Authn/z with OAUTHBEARER