postgresql/src/include/utils
David Rowley 40af10b571 Use Generation memory contexts to store tuples in sorts
The general usage pattern when we store tuples in tuplesort.c is that
we store a series of tuples one by one then either perform a sort or spill
them to disk.  In the common case, there is no pfreeing of already stored
tuples.  For the common case since we do not individually pfree tuples, we
have very little need for aset.c memory allocation behavior which
maintains freelists and always rounds allocation sizes up to the next
power of 2 size.

Here we conditionally use generation.c contexts for storing tuples in
tuplesort.c when the sort will never be bounded.  Unfortunately, the
memory context to store tuples is already created by the time any calls
would be made to tuplesort_set_bound(), so here we add a new sort option
that allows callers to specify if they're going to need a bounded sort or
not.  We'll use a standard aset.c allocator when this sort option is not
set.

Extension authors must ensure that the TUPLESORT_ALLOWBOUNDED flag is
used when calling tuplesort_begin_* for any sorts that make a call to
tuplesort_set_bound().

Author: David Rowley
Reviewed-by: Andy Fan
Discussion: https://postgr.es/m/CAApHDvoH4ASzsAOyHcxkuY01Qf++8JJ0paw+03dk+W25tQEcNQ@mail.gmail.com
2022-04-04 22:52:35 +12:00
..
.gitignore Revert "Add gitignore entries for jsonpath_gram.h" 2019-03-23 00:19:34 +01:00
acl.h Add String object access hooks 2022-03-22 10:28:31 -04:00
aclchk_internal.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
array.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
arrayaccess.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
ascii.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
attoptcache.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
backend_progress.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
backend_status.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
builtins.h Remove pg_atoi() 2022-02-15 07:44:26 +01:00
bytea.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
cash.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
catcache.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
combocid.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
date.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
datetime.h Fix overflow hazards in interval input and output conversions. 2022-04-02 16:12:29 -04:00
datum.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
dsa.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
dynahash.h Fix various typos, grammar and code style in comments and docs 2022-01-25 09:40:04 +09:00
elog.h Introduce log_destination=jsonlog 2022-01-17 10:16:53 +09:00
evtcache.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
expandeddatum.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
expandedrecord.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
float.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
fmgrtab.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
formatting.h SQL/JSON query functions 2022-03-29 16:57:13 -04:00
freepage.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
geo_decls.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
guc.h Disallow setting bogus GUCs within an extension's reserved namespace. 2022-02-21 14:10:43 -05:00
guc_tables.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
help_config.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
hsearch.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
index_selfuncs.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
inet.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
inval.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
json.h SQL JSON functions 2022-03-30 16:30:37 -04:00
jsonb.h SQL JSON functions 2022-03-30 16:30:37 -04:00
jsonfuncs.h SQL/JSON query functions 2022-03-29 16:57:13 -04:00
jsonpath.h SQL/JSON query functions 2022-03-29 16:57:13 -04:00
logtape.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
lsyscache.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
memdebug.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
memutils.h Improve the generation memory allocator 2022-04-04 20:53:13 +12:00
multirangetypes.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
numeric.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
old_snapshot.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
palloc.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
partcache.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_crc.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_locale.h Fix global ICU collations for ICU < 54 2022-03-20 10:21:45 +01:00
pg_lsn.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_rusage.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pgstat_internal.h pgstat: split different types of stats into separate files. 2022-03-21 12:02:25 -07:00
pidfile.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
plancache.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
portal.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
ps_status.h Refactor ps_status.c API 2020-03-11 16:38:31 +01:00
queryenvironment.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
queryjumble.h Add compute_query_id = regress 2022-02-22 10:22:15 +09:00
rangetypes.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
regproc.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
rel.h Remove obsolete comment 2022-04-02 07:41:12 +02:00
relcache.h Allow specifying row filters for logical replication of tables. 2022-02-22 08:11:50 +05:30
relfilenodemap.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
relmapper.h Add new block-by-block strategy for CREATE DATABASE. 2022-03-29 11:48:36 -04:00
relptr.h Suppress compiler warning in relptr_store(). 2022-03-26 14:30:09 -04:00
reltrigger.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
resowner.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
resowner_private.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
rls.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
ruleutils.h Add public ruleutils.c entry point to deparse a Query. 2022-03-28 11:19:37 -04:00
sampling.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
selfuncs.h Optimize order of GROUP BY keys 2022-03-31 01:13:33 +02:00
sharedtuplestore.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
snapmgr.h Assert in init_toast_snapshot() that some snapshot registered or active. 2022-02-21 08:58:29 -08:00
snapshot.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
sortsupport.h Specialize tuplesort routines for different kinds of abbreviated keys 2022-04-02 15:22:25 +07:00
spccache.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
syscache.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
timeout.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
timestamp.h Fix overflow hazards in interval input and output conversions. 2022-04-02 16:12:29 -04:00
tuplesort.h Use Generation memory contexts to store tuples in sorts 2022-04-04 22:52:35 +12:00
tuplestore.h Remove all traces of tuplestore_donestoring() in the C code 2022-02-17 09:52:02 +09:00
typcache.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tzparser.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
uuid.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
varbit.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
varlena.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
wait_event.h Add new block-by-block strategy for CREATE DATABASE. 2022-03-29 11:48:36 -04:00
xid8.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
xml.h Update copyright for 2022 2022-01-07 19:04:57 -05:00