Re: Potential Issue with Redundant Restriction Clauses in get_parameterized_baserel_size for PARTITIONED_REL - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Potential Issue with Redundant Restriction Clauses in get_parameterized_baserel_size for PARTITIONED_REL
Date
Msg-id 1763158.1732674375@sss.pgh.pa.us
Whole thread Raw
In response to Potential Issue with Redundant Restriction Clauses in get_parameterized_baserel_size for PARTITIONED_REL  (huyajun <hu_yajun@qq.com>)
List pgsql-hackers
David Rowley <dgrowleyml@gmail.com> writes:
> It would be good to understand why get_parameterized_baserel_size()
> bothers accounting for the baserestrictinfo quals and does not just do
> clauselist_selectivity() on param_clauses alone and multiply by
> rel->rows (which should already account for the baserestrictinfo).

One reason is that clauselist_selectivity does not necessarily
treat all the clauses independently.  For example, if "x > 1"
is in one list and "x < 4" is in the other, you'll get very
different (and worse) results if you keep the lists separate
and just multiply their selectivities together.

We do have per-RestrictInfo selectivity caching that eliminates
most of the apparent inefficiency in this.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Count and log pages set all-frozen by vacuum
Next
From: David Rowley
Date:
Subject: Re: Proposals for EXPLAIN: rename ANALYZE to EXECUTE and extend VERBOSE