Should total_pages be calculated after partition pruning andconstraint exclusion? - Mailing list pgsql-hackers

From David Rowley
Subject Should total_pages be calculated after partition pruning andconstraint exclusion?
Date
Msg-id CAKJS1f_eUz0_h5_vU1rqE7wuxMcoENcWK2FTODz0pOyxp3_Uig@mail.gmail.com
Whole thread Raw
Responses Re: Should total_pages be calculated after partition pruning and constraint exclusion?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
It seems quite strange to me that we calculate total_pages before any
partition pruning and constraint exclusion is performed during
set_base_rel_sizes(). Wouldn't it be better to wait until after that's
done so we don't mistakenly count relations we're not going to scan?

Delaying the calculation until after set_base_rel_sizes() means it's
still done in time before it's needed in set_base_rel_pathlists().

The attached patch implements the change.

There are no visible plan changes in the regression tests, but the
change can affect the plans for larger partitioned tables.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: legrand legrand
Date:
Subject: Re: explain (verbose off, normalized) vs query planid
Next
From: Bruce Momjian
Date:
Subject: Re: Postgres 11 release notes