postgresql/src/backend
Tom Lane f7816aec23 Extract column statistics from CTE references, if possible.
examine_simple_variable() left this as an unimplemented case years
ago, with the result that plans for queries involving un-flattened
CTEs might be much stupider than necessary.  It's not hard to extend
the existing logic for RTE_SUBQUERY cases to also be able to drill
down into CTEs, so let's do that.

There was some discussion of whether this patch breaks the idea
of a MATERIALIZED CTE being an optimization fence.  We concluded
it's okay, because we already allow the outer planner level to
see the estimated width and rowcount of the CTE result, and
letting it see column statistics too seems fairly equivalent.
Basically, what we expect of the optimization fence is that the
outer query should not affect the plan chosen for the CTE query.
Once that plan is chosen, it's okay for the outer planner level
to make use of whatever information we have about it.

Jian Guo and Tom Lane, per complaint from Hans Buschmann

Discussion: https://postgr.es/m/4504e67078d648cdac3651b2960da6e7@nidsa.net
2023-11-17 14:36:23 -05:00
..
access Retire MemoryContextResetAndDeleteChildren() macro. 2023-11-15 13:42:30 -06:00
archive
backup Change how a base backup decides which files have checksums. 2023-11-14 10:51:05 -05:00
bootstrap Remove distprep 2023-11-06 15:18:04 +01:00
catalog Ensure we preprocess expressions before checking their volatility. 2023-11-16 10:05:14 -05:00
commands Ensure we preprocess expressions before checking their volatility. 2023-11-16 10:05:14 -05:00
executor Retire MemoryContextResetAndDeleteChildren() macro. 2023-11-15 13:42:30 -06:00
foreign Expand some more uses of "deleg" to "delegation" or "delegated". 2023-05-21 10:55:18 -04:00
jit Make ResourceOwners more easily extensible. 2023-11-08 13:30:50 +02:00
lib Make binaryheap available to frontend code. 2023-09-18 12:18:33 -07:00
libpq Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
main Remove obsolete defense against strxfrm() bugs. 2023-04-20 13:20:14 +12:00
nodes Remove distprep 2023-11-06 15:18:04 +01:00
optimizer Ensure we preprocess expressions before checking their volatility. 2023-11-16 10:05:14 -05:00
parser Compute aggregate argument types correctly in transformAggregateCall(). 2023-11-06 10:38:00 -05:00
partitioning Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
po Translation updates 2023-08-07 12:39:30 +02:00
port Remove distprep 2023-11-06 15:18:04 +01:00
postmaster Retire MemoryContextResetAndDeleteChildren() macro. 2023-11-15 13:42:30 -06:00
regex Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
replication Retire MemoryContextResetAndDeleteChildren() macro. 2023-11-15 13:42:30 -06:00
rewrite Add TupleDescGetDefault() 2023-09-27 18:52:40 +01:00
snowball Remove distprep 2023-11-06 15:18:04 +01:00
statistics Retire MemoryContextResetAndDeleteChildren() macro. 2023-11-15 13:42:30 -06:00
storage Change logtape/tuplestore code to use int64 for block numbers 2023-11-17 11:20:53 +09:00
tcop Retire MemoryContextResetAndDeleteChildren() macro. 2023-11-15 13:42:30 -06:00
tsearch Limit to_tsvector_byid's initial array allocation to something sane. 2023-09-25 11:50:28 -04:00
utils Extract column statistics from CTE references, if possible. 2023-11-17 14:36:23 -05:00
.gitignore
common.mk
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
meson.build Add win32ver data to meson-built postgres.exe. 2023-06-12 07:40:38 -07:00
nls.mk Remove distprep 2023-11-06 15:18:04 +01:00