postgresql/contrib
Tom Lane a5fc46414d Avoid making commutatively-duplicate clauses in EquivalenceClasses.
When we decide we need to make a derived clause equating a.x and
b.y, we already will re-use a previously-made clause "a.x = b.y".
But we might instead have "b.y = a.x", which is perfectly usable
because equivclass.c has never promised anything about the
operand order in clauses it builds.  Saving construction of a
new RestrictInfo doesn't matter all that much in itself --- but
because we cache selectivity estimates and so on per-RestrictInfo,
there's a possibility of saving a fair amount of duplicative
effort downstream.

Hence, check for commutative matches as well as direct ones when
seeing if we have a pre-existing clause.  This changes the visible
clause order in several regression test cases, but they're all
clearly-insignificant changes.

Checking for the reverse operand order is simple enough, but
if we wanted to check for operator OID match we'd need to call
get_commutator here, which is not so cheap.  I concluded that
we don't really need the operator check anyway, so I just
removed it.  It's unlikely that an opfamily contains more than
one applicable operator for a given pair of operand datatypes;
and if it does they had better give the same answers, so there
seems little need to insist that we use exactly the one
select_equality_operator chose.

Using the current core regression suite as a test case, I see
this change reducing the number of new join clauses built by
create_join_clause from 9673 to 5142 (out of 26652 calls).
So not quite 50% savings, but pretty close to it.

Discussion: https://postgr.es/m/78062.1666735746@sss.pgh.pa.us
2022-10-27 14:42:18 -04:00
..
adminpack tests: Rename conflicting role names 2022-10-05 10:43:13 -07:00
amcheck Rename SetSingleFuncCall() to InitMaterializedSRF() 2022-10-18 10:22:35 +09:00
auth_delay meson: Add windows resource files 2022-10-05 09:56:05 -07:00
auto_explain meson: Add windows resource files 2022-10-05 09:56:05 -07:00
basebackup_to_shell meson: Add windows resource files 2022-10-05 09:56:05 -07:00
basic_archive Fix calculation related to temporary WAL segment name in basic_archive 2022-10-17 11:40:14 +09:00
bloom meson: Add support for building with precompiled headers 2022-10-06 17:19:30 -07:00
bool_plperl meson: Add windows resource files 2022-10-05 09:56:05 -07:00
btree_gin meson: Add windows resource files 2022-10-05 09:56:05 -07:00
btree_gist Use C library functions instead of Abs() for int64 2022-10-10 09:01:17 +02:00
citext meson: Add windows resource files 2022-10-05 09:56:05 -07:00
cube Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
dblink Rename SetSingleFuncCall() to InitMaterializedSRF() 2022-10-18 10:22:35 +09:00
dict_int meson: Add windows resource files 2022-10-05 09:56:05 -07:00
dict_xsyn meson: Add windows resource files 2022-10-05 09:56:05 -07:00
earthdistance meson: Add windows resource files 2022-10-05 09:56:05 -07:00
file_fdw Fix final warnings produced by -Wshadow=compatible-local 2022-10-07 13:13:27 +13:00
fuzzystrmatch meson: Add windows resource files 2022-10-05 09:56:05 -07:00
hstore meson: Add support for building with precompiled headers 2022-10-06 17:19:30 -07:00
hstore_plperl meson: Add windows resource files 2022-10-05 09:56:05 -07:00
hstore_plpython meson: Add windows resource files 2022-10-05 09:56:05 -07:00
intagg meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
intarray Use fabsf() instead of Abs() or fabs() where appropriate 2022-10-08 13:43:26 +02:00
isn meson: Add windows resource files 2022-10-05 09:56:05 -07:00
jsonb_plperl meson: Add windows resource files 2022-10-05 09:56:05 -07:00
jsonb_plpython meson: Add windows resource files 2022-10-05 09:56:05 -07:00
lo meson: Add windows resource files 2022-10-05 09:56:05 -07:00
ltree Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
ltree_plpython meson: Add windows resource files 2022-10-05 09:56:05 -07:00
oid2name meson: Add windows resource files 2022-10-05 09:56:05 -07:00
old_snapshot meson: Add windows resource files 2022-10-05 09:56:05 -07:00
pageinspect Rename SetSingleFuncCall() to InitMaterializedSRF() 2022-10-18 10:22:35 +09:00
passwordcheck tests: Rename conflicting role names 2022-10-05 10:43:13 -07:00
pg_buffercache pg_buffercache: Add pg_buffercache_summary() 2022-10-13 09:55:46 -07:00
pg_freespacemap meson: Add windows resource files 2022-10-05 09:56:05 -07:00
pg_prewarm Standardize format for printing PIDs 2022-10-14 08:38:53 +02:00
pg_stat_statements Rename SetSingleFuncCall() to InitMaterializedSRF() 2022-10-18 10:22:35 +09:00
pg_surgery meson: Add windows resource files 2022-10-05 09:56:05 -07:00
pg_trgm meson: Add support for building with precompiled headers 2022-10-06 17:19:30 -07:00
pg_visibility meson: Add windows resource files 2022-10-05 09:56:05 -07:00
pg_walinspect Rename SetSingleFuncCall() to InitMaterializedSRF() 2022-10-18 10:22:35 +09:00
pgcrypto Remove redundant memset call following palloc0 2022-10-13 23:18:00 +02:00
pgrowlocks Rename SetSingleFuncCall() to InitMaterializedSRF() 2022-10-18 10:22:35 +09:00
pgstattuple meson: Add support for building with precompiled headers 2022-10-06 17:19:30 -07:00
postgres_fdw Avoid making commutatively-duplicate clauses in EquivalenceClasses. 2022-10-27 14:42:18 -04:00
seg Use fabsf() instead of Abs() or fabs() where appropriate 2022-10-08 13:43:26 +02:00
sepgsql meson: Add support for building with precompiled headers 2022-10-06 17:19:30 -07:00
spi meson: Add windows resource files 2022-10-05 09:56:05 -07:00
sslinfo meson: Add windows resource files 2022-10-05 09:56:05 -07:00
start-scripts Remove contrib/start-scripts/osx/. 2017-11-17 12:53:20 -05:00
tablefunc meson: Add windows resource files 2022-10-05 09:56:05 -07:00
tcn meson: Add windows resource files 2022-10-05 09:56:05 -07:00
test_decoding Fix assertion failures while processing NEW_CID record in logical decoding. 2022-10-20 08:49:48 +05:30
tsm_system_rows meson: Add windows resource files 2022-10-05 09:56:05 -07:00
tsm_system_time meson: Add windows resource files 2022-10-05 09:56:05 -07:00
unaccent meson: Add windows resource files 2022-10-05 09:56:05 -07:00
uuid-ossp meson: Add windows resource files 2022-10-05 09:56:05 -07:00
vacuumlo meson: Add windows resource files 2022-10-05 09:56:05 -07:00
xml2 Rename SetSingleFuncCall() to InitMaterializedSRF() 2022-10-18 10:22:35 +09:00
Makefile Add contrib/pg_walinspect. 2022-04-08 00:26:44 -07:00
README Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00
contrib-global.mk Respect TEMP_CONFIG when pg_regress_check and friends are called 2016-02-27 12:28:21 -05:00
meson.build meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00

README

The PostgreSQL contrib tree
---------------------------

This subtree contains porting tools, analysis utilities, and plug-in
features that are not part of the core PostgreSQL system, mainly
because they address a limited audience or are too experimental to be
part of the main source tree.  This does not preclude their
usefulness.

User documentation for each module appears in the main SGML
documentation.

When building from the source distribution, these modules are not
built automatically, unless you build the "world" target.  You can
also build and install them all by running "make all" and "make
install" in this directory; or to build and install just one selected
module, do the same in that module's subdirectory.

Some directories supply new user-defined functions, operators, or
types.  To make use of one of these modules, after you have installed
the code you need to register the new SQL objects in the database
system by executing a CREATE EXTENSION command.  In a fresh database,
you can simply do

    CREATE EXTENSION module_name;

See the PostgreSQL documentation for more information about this
procedure.