postgresql/contrib
Andres Freund a9c35cf85c Change function call information to be variable length.
Before this change FunctionCallInfoData, the struct arguments etc for
V1 function calls are stored in, always had space for
FUNC_MAX_ARGS/100 arguments, storing datums and their nullness in two
arrays.  For nearly every function call 100 arguments is far more than
needed, therefore wasting memory. Arg and argnull being two separate
arrays also guarantees that to access a single argument, two
cachelines have to be touched.

Change the layout so there's a single variable-length array with pairs
of value / isnull. That drastically reduces memory consumption for
most function calls (on x86-64 a two argument function now uses
64bytes, previously 936 bytes), and makes it very likely that argument
value and its nullness are on the same cacheline.

Arguments are stored in a new NullableDatum struct, which, due to
padding, needs more memory per argument than before. But as usually
far fewer arguments are stored, and individual arguments are cheaper
to access, that's still a clear win.  It's likely that there's other
places where conversion to NullableDatum arrays would make sense,
e.g. TupleTableSlots, but that's for another commit.

Because the function call information is now variable-length
allocations have to take the number of arguments into account. For
heap allocations that can be done with SizeForFunctionCallInfoData(),
for on-stack allocations there's a new LOCAL_FCINFO(name, nargs) macro
that helps to allocate an appropriately sized and aligned variable.

Some places with stack allocation function call information don't know
the number of arguments at compile time, and currently variably sized
stack allocations aren't allowed in postgres. Therefore allow for
FUNC_MAX_ARGS space in these cases. They're not that common, so for
now that seems acceptable.

Because of the need to allocate FunctionCallInfo of the appropriate
size, older extensions may need to update their code. To avoid subtle
breakages, the FunctionCallInfoData struct has been renamed to
FunctionCallInfoBaseData. Most code only references FunctionCallInfo,
so that shouldn't cause much collateral damage.

This change is also a prerequisite for more efficient expression JIT
compilation (by allocating the function call information on the stack,
allowing LLVM to optimize it away); previously the size of the call
information caused problems inside LLVM's optimizer.

Author: Andres Freund
Reviewed-By: Tom Lane
Discussion: https://postgr.es/m/20180605172952.x34m5uz6ju6enaem@alap3.anarazel.de
2019-01-26 14:17:52 -08:00
..
adminpack Update copyright for 2019 2019-01-02 12:44:25 -05:00
amcheck Move generic snapshot related code from tqual.h to snapmgr.h. 2019-01-21 17:06:41 -08:00
auth_delay Update copyright for 2019 2019-01-02 12:44:25 -05:00
auto_explain Update copyright for 2019 2019-01-02 12:44:25 -05:00
bloom Update copyright for 2019 2019-01-02 12:44:25 -05:00
btree_gin Provide separate header file for built-in float types 2018-07-29 03:30:48 +02:00
btree_gist Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
citext Add a 64-bit hash function for type citext. 2018-11-23 13:24:45 -05:00
cube Make float exponent output on Windows look the same as elsewhere. 2018-10-12 11:14:27 -04:00
dblink Remove superfluous tqual.h includes. 2019-01-21 12:15:02 -08:00
dict_int Update copyright for 2019 2019-01-02 12:44:25 -05:00
dict_xsyn Update copyright for 2019 2019-01-02 12:44:25 -05:00
earthdistance Fix earthdistance test suite function name typo. 2018-07-29 12:02:07 -07:00
file_fdw Replace uses of heap_open et al with the corresponding table_* function. 2019-01-21 10:51:37 -08:00
fuzzystrmatch Update copyright for 2019 2019-01-02 12:44:25 -05:00
hstore Change function call information to be variable length. 2019-01-26 14:17:52 -08:00
hstore_plperl Still further rethinking of build changes for macOS Mojave. 2018-10-18 14:55:23 -04:00
hstore_plpython Fix out-of-tree build for transform modules. 2018-09-16 18:46:45 +01:00
intagg Schema-qualify some references to regprocedure. 2016-06-10 10:41:58 -04:00
intarray Update copyright for 2019 2019-01-02 12:44:25 -05:00
isn Update copyright for 2019 2019-01-02 12:44:25 -05:00
jsonb_plperl Still further rethinking of build changes for macOS Mojave. 2018-10-18 14:55:23 -04:00
jsonb_plpython Remove redundant allocation 2018-10-05 17:10:58 +02:00
lo lo: Add test suite 2017-09-14 22:22:59 -04:00
ltree Allow btree comparison functions to return INT_MIN. 2018-10-05 16:01:29 -04:00
ltree_plpython Fix out-of-tree build for transform modules. 2018-09-16 18:46:45 +01:00
oid2name Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00
pageinspect Replace heapam.h includes with {table, relation}.h where applicable. 2019-01-21 10:51:37 -08:00
passwordcheck Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_buffercache Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
pg_freespacemap Replace heapam.h includes with {table, relation}.h where applicable. 2019-01-21 10:51:37 -08:00
pg_prewarm Replace heapam.h includes with {table, relation}.h where applicable. 2019-01-21 10:51:37 -08:00
pg_standby Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00
pg_stat_statements Extend pg_stat_statements_reset to reset statistics specific to a 2019-01-11 08:50:09 +05:30
pg_trgm Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_visibility Move remaining code from tqual.[ch] to heapam.h / heapam_visibility.c. 2019-01-21 17:07:10 -08:00
pgcrypto Fix misc typos in comments. 2019-01-23 13:39:00 +02:00
pgrowlocks Move remaining code from tqual.[ch] to heapam.h / heapam_visibility.c. 2019-01-21 17:07:10 -08:00
pgstattuple Move remaining code from tqual.[ch] to heapam.h / heapam_visibility.c. 2019-01-21 17:07:10 -08:00
postgres_fdw postgres_fdw: Account for tlist eval costs in estimate_path_cost_size(). 2019-01-24 16:49:17 +09:00
seg Make float exponent output on Windows look the same as elsewhere. 2018-10-12 11:14:27 -04:00
sepgsql Move generic snapshot related code from tqual.h to snapmgr.h. 2019-01-21 17:06:41 -08:00
spi Remove timetravel extension. 2018-10-11 11:43:56 -07:00
sslinfo Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
start-scripts Remove contrib/start-scripts/osx/. 2017-11-17 12:53:20 -05:00
tablefunc Update copyright for 2019 2019-01-02 12:44:25 -05:00
tcn Update copyright for 2019 2019-01-02 12:44:25 -05:00
test_decoding Update copyright for 2019 2019-01-02 12:44:25 -05:00
tsm_system_rows Don't include heapam.h from others headers. 2019-01-14 16:24:41 -08:00
tsm_system_time Don't include heapam.h from others headers. 2019-01-14 16:24:41 -08:00
unaccent Update unaccent rules with release 34 of CLDR for Latin-ASCII.xml 2019-01-10 14:10:21 +09:00
uuid-ossp Update copyright for 2019 2019-01-02 12:44:25 -05:00
vacuumlo Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00
xml2 Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
Makefile Transforms for jsonb to PL/Perl 2018-04-03 09:47:18 -04: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

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.