1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-31 05:54:36 +03:00
Richard Guo 31c002aa89 Collect quals for outer-join reduction on demand
To prove that a forced-null Var is non-nullable in every matching row,
reduce_outer_joins() uses the strict quals that hold for every row a
subtree emits.  The first pass currently gathers those quals into each
subtree's state, so that the second pass need not re-walk the jointree
at decision time.

That duplicates find_subquery_safe_quals(), which already performs
this traversal for query_outputs_are_not_nullable(), and it charges
every query containing an outer join for a list build at every
FromExpr and every inner or semi join, whether or not any upper qual
turns out to force a Var null.  Since each level copies what its
children collected, the space required grows quadratically with the
depth of nested inner joins.  What it buys is small even then: the
walk it avoids is cheap enough to be called on demand.

So rename find_subquery_safe_quals() to find_safe_quals(), export it,
and drop safe_quals from the first pass's state in favor of the
subtree's jointree node.  The second pass calls find_safe_quals() at
the point where it needs the proof.

Also stop treating a semijoin there like a left join: semijoins are
reachable from the new caller, and a semijoin emits only matched
left-hand rows, so its ON quals do hold for every output row.

Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/CAMbWs4-6FazY7+vCOvR0-vqNuaXOZic8O4D4ZrwMm2woi+Q3uA@mail.gmail.com
2026-08-21 15:51:57 +09:00
2026-07-17 11:48:35 -04:00
2026-08-20 21:35:47 -04:00
2022-12-04 15:23:00 -05:00
2024-11-05 13:56:02 +01:00
2026-07-16 12:03:05 +02:00
2026-01-01 13:24:10 -05:00
2020-02-10 20:47:50 +01:00
2026-02-23 13:34:22 -05:00

PostgreSQL Database Management System

This directory contains the source code distribution of the PostgreSQL database management system.

PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.

Copyright and license information can be found in the file COPYRIGHT.

General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.

The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.

Description
Зеркало официального репозитория PostgreSQL GIT
Readme 1.2 GiB
Languages
C 83.9%
PLpgSQL 6.2%
Perl 5.4%
Yacc 1.2%
Meson 0.7%
Other 2.4%