On Thu, May 1, 2025 at 4:33 AM Richard Guo <guofengli...@gmail.com> wrote: > Here is the patchset that implements this optimization. 0001 moves > the expansion of virtual generated columns to occur before sublink > pull-up. 0002 introduces a new function, preprocess_relation_rtes, > which scans the rangetable for relation RTEs and performs inh flag > updates and virtual generated column expansion in a single loop, so > that only one table_open/table_close call is required for each > relation. 0003 collects NOT NULL attribute information for each > relation within the same loop, stores it in a relation OID based hash > table, and uses this information to reduce NullTest quals during > constant folding. > > I think the code now more closely resembles the phase 1 and phase 2 > described earlier: it collects all required early-stage catalog > information within a single loop over the rangetable, allowing each > relation to be opened and closed only once. It also avoids the > has_subclass() call along the way.
Before we commit to something along these lines, I think we need to understand whether Tom intends to press Peter for some bigger change around expand_virtual_generated_columns. If Tom doesn't respond right away, I suggest that we need to add an open item for http://postgr.es/m/602561.1744314...@sss.pgh.pa.us -- Robert Haas EDB: http://www.enterprisedb.com