postgresql/contrib
Tom Lane f4c7c410ee Revert "Optimize order of GROUP BY keys".
This reverts commit db0d67db24 and
several follow-on fixes.  The idea of making a cost-based choice
of the order of the sorting columns is not fundamentally unsound,
but it requires cost information and data statistics that we don't
really have.  For example, relying on procost to distinguish the
relative costs of different sort comparators is pretty pointless
so long as most such comparator functions are labeled with cost 1.0.
Moreover, estimating the number of comparisons done by Quicksort
requires more than just an estimate of the number of distinct values
in the input: you also need some idea of the sizes of the larger
groups, if you want an estimate that's good to better than a factor of
three or so.  That's data that's often unknown or not very reliable.
Worse, to arrive at estimates of the number of calls made to the
lower-order-column comparison functions, the code needs to make
estimates of the numbers of distinct values of multiple columns,
which are necessarily even less trustworthy than per-column stats.
Even if all the inputs are perfectly reliable, the cost algorithm
as-implemented cannot offer useful information about how to order
sorting columns beyond the point at which the average group size
is estimated to drop to 1.

Close inspection of the code added by db0d67db2 shows that there
are also multiple small bugs.  These could have been fixed, but
there's not much point if we don't trust the estimates to be
accurate in-principle.

Finally, the changes in cost_sort's behavior made for very large
changes (often a factor of 2 or so) in the cost estimates for all
sorting operations, not only those for multi-column GROUP BY.
That naturally changes plan choices in many situations, and there's
precious little evidence to show that the changes are for the better.
Given the above doubts about whether the new estimates are really
trustworthy, it's hard to summon much confidence that these changes
are better on the average.

Since we're hard up against the release deadline for v15, let's
revert these changes for now.  We can always try again later.

Note: in v15, I left T_PathKeyInfo in place in nodes.h even though
it's unreferenced.  Removing it would be an ABI break, and it seems
a bit late in the release cycle for that.

Discussion: https://postgr.es/m/TYAPR01MB586665EB5FB2C3807E893941F5579@TYAPR01MB5866.jpnprd01.prod.outlook.com
2022-10-03 10:56:16 -04:00
..
adminpack meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
amcheck Harmonize parameter names in contrib code. 2022-09-22 13:59:20 -07:00
auth_delay meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
auto_explain meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
basebackup_to_shell meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
basic_archive meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
bloom meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
bool_plperl meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
btree_gin meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
btree_gist meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
citext meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
cube Harmonize parameter names in contrib code. 2022-09-22 13:59:20 -07:00
dblink Harmonize parameter names in contrib code. 2022-09-22 13:59:20 -07:00
dict_int meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
dict_xsyn meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
earthdistance meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
file_fdw meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
fuzzystrmatch Harmonize parameter names in contrib code. 2022-09-22 13:59:20 -07:00
hstore meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
hstore_plperl meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
hstore_plpython meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
intagg meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
intarray Convert *GetDatum() and DatumGet*() macros to inline functions 2022-09-27 20:50:21 +02:00
isn meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
jsonb_plperl meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
jsonb_plpython meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
lo meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
ltree Harmonize parameter names in contrib code. 2022-09-22 13:59:20 -07:00
ltree_plpython meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
oid2name Harmonize parameter names in contrib code. 2022-09-22 13:59:20 -07:00
old_snapshot meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
pageinspect meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
passwordcheck meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
pg_buffercache Revert 56-bit relfilenode change and follow-up commits. 2022-09-28 09:55:28 -04:00
pg_freespacemap meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
pg_prewarm Revert 56-bit relfilenode change and follow-up commits. 2022-09-28 09:55:28 -04:00
pg_stat_statements Restore pg_pread and friends. 2022-09-29 13:12:11 +13:00
pg_surgery meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
pg_trgm meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
pg_visibility meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
pg_walinspect Revert 56-bit relfilenode change and follow-up commits. 2022-09-28 09:55:28 -04:00
pgcrypto Harmonize parameter names in contrib code. 2022-09-22 13:59:20 -07:00
pgrowlocks meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
pgstattuple meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
postgres_fdw Revert "Optimize order of GROUP BY keys". 2022-10-03 10:56:16 -04:00
seg Harmonize parameter names in contrib code. 2022-09-22 13:59:20 -07:00
sepgsql meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
spi meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
sslinfo meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
start-scripts Remove contrib/start-scripts/osx/. 2017-11-17 12:53:20 -05:00
tablefunc Harmonize parameter names in contrib code. 2022-09-22 13:59:20 -07:00
tcn meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
test_decoding Harmonize parameter names in contrib code. 2022-09-22 13:59:20 -07:00
tsm_system_rows meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
tsm_system_time meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
unaccent meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
uuid-ossp meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
vacuumlo meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
xml2 meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
contrib-global.mk Respect TEMP_CONFIG when pg_regress_check and friends are called 2016-02-27 12:28:21 -05:00
Makefile Add contrib/pg_walinspect. 2022-04-08 00:26:44 -07:00
meson.build meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
README Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00

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.