Re: Reduce "Var IS [NOT] NULL" quals during constant folding
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, David Rowley <dgrowleyml@gmail.com>, Tender Wang <tndrwang@gmail.com>,
Pg Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-04-01T19:34:45Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix misuse of Relids for storing attribute numbers
- 2d756ebbe857 19 (unreleased) landed
-
Reduce "Var IS [NOT] NULL" quals during constant folding
- e2debb64380e 19 (unreleased) landed
-
Centralize collection of catalog info needed early in the planner
- 904f6a593a06 19 (unreleased) landed
-
Expand virtual generated columns before sublink pull-up
- e0d05295268e 19 (unreleased) landed
-
Expand virtual generated columns in the planner
- 1e4351af329f 18.0 cited
On Tue, Apr 1, 2025 at 2:34 AM Richard Guo <guofenglinux@gmail.com> wrote: > However, I gave up this idea because I realized it would require > retrieving a whole bundle of catalog information that isn't needed > until after the RelOptInfos are built, such as max_attr, pages, > tuples, reltablespace, parallel_workers, extended statistics, etc. Why is that bad? I mean, if we're going to need that information anyway, then gathering it at earlier stage doesn't hurt. Of course, if we move it too early, say before partition pruning, then we might gather information we don't really need and hurt performance. But otherwise it doesn't seem to hurt anything. > And we may also need to create the IndexOptInfos for the relation's > indexes. It seems to me that it's not a trivial task to move > get_relation_info() before building the RelOptInfos, and more > importantly, it's unnecessary most of the time. But again, if the work is going to have to be done anyway, who cares? > It could be argued that the separation of catalog information > collection isn't very great, but it seems this isn't something new in > this patch. So I respectfully disagree with your statement that "all > the information that the planner needs about a particular relation is > retrieved by get_relation_info()", and that "there's now just exactly > this 1 thing that is done in a different place". For instance, > relhassubclass and attgenerated are retrieved before expression > preprocessing, a relation's constraint expressions are retrieved when > setting the relation's size estimates, and more. Nonetheless I think we ought to be trying to consolidate more things into get_relation_info(), not disperse some of the things that are there to other places. -- Robert Haas EDB: http://www.enterprisedb.com