postgresql/src/backend
David Rowley 1b0d9aa4f7 Improve the generation memory allocator
Here we make a series of improvements to the generation memory
allocator, namely:

1. Allow generation contexts to have a minimum, initial and maximum block
sizes. The standard allocator allows this already but when the generation
context was added, it only allowed fixed-sized blocks.  The problem with
fixed-sized blocks is that it's difficult to choose how large to make the
blocks.  If the chosen size is too small then we'd end up with a large
number of blocks and a large number of malloc calls. If the block size is
made too large, then memory is wasted.

2. Add support for "keeper" blocks.  This is a special block that is
allocated along with the context itself but is never freed.  Instead,
when the last chunk in the keeper block is freed, we simply mark the block
as empty to allow new allocations to make use of it.

3. Add facility to "recycle" newly empty blocks instead of freeing them
and having to later malloc an entire new block again.  We do this by
recording a single GenerationBlock which has become empty of any chunks.
When we run out of space in the current block, we check to see if there is
a "freeblock" and use that if it contains enough space for the allocation.

Author: David Rowley, Tomas Vondra
Reviewed-by: Andy Fan
Discussion: https://postgr.es/m/d987fd54-01f8-0f73-af6c-519f799a0ab8@enterprisedb.com
2022-04-04 20:53:13 +12:00
..
access Improve the generation memory allocator 2022-04-04 20:53:13 +12:00
bootstrap pg_upgrade: Preserve relfilenodes and tablespace OIDs. 2022-01-17 13:40:27 -05:00
catalog Add new block-by-block strategy for CREATE DATABASE. 2022-03-29 11:48:36 -04:00
commands Set relfrozenxid to oldest extant XID seen by VACUUM. 2022-04-03 09:57:21 -07:00
executor SQL JSON functions 2022-03-30 16:30:37 -04:00
foreign Create routine able to set single-call SRFs for Materialize mode 2022-03-07 10:26:29 +09:00
jit SQL/JSON query functions 2022-03-29 16:57:13 -04:00
lib dshash: Add sequential scan support. 2022-03-10 12:57:05 -08:00
libpq Add system view pg_ident_file_mappings 2022-03-29 10:15:48 +09:00
main Fix collection of typos in the code and the documentation 2022-03-15 11:29:35 +09:00
nodes RETURNING clause for JSON() and JSON_SCALAR() 2022-03-31 15:45:24 -04:00
optimizer Fix comments with "a expression" 2022-03-31 15:45:25 -04:00
parser Fix comments with "a expression" 2022-03-31 15:45:25 -04:00
partitioning Fix misuse of "const" qualifier. 2022-02-13 19:20:56 -05:00
po Translation updates 2021-06-21 12:33:50 +02:00
port Ensure that the argument of shmdt(2) is declared "void *". 2022-02-15 17:17:28 -05:00
postmaster pgstat: fix function name in comment. 2022-03-22 08:15:40 -07:00
regex Call pg_newlocale_from_collation() also with default collation 2022-01-20 09:50:18 +01:00
replication Improve the generation memory allocator 2022-04-04 20:53:13 +12:00
rewrite Add support for MERGE SQL command 2022-03-28 16:47:48 +02:00
snowball Update copyright for 2022 2022-01-07 19:04:57 -05:00
statistics Fix various typos, grammar and code style in comments and docs 2022-01-25 09:40:04 +09:00
storage Add new block-by-block strategy for CREATE DATABASE. 2022-03-29 11:48:36 -04:00
tcop Add support for MERGE SQL command 2022-03-28 16:47:48 +02:00
tsearch Update copyright for 2022 2022-01-07 19:04:57 -05:00
utils Improve the generation memory allocator 2022-04-04 20:53:13 +12:00
.gitignore
Makefile Server-side gzip compression. 2022-01-24 15:13:18 -05:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Report progress of startup operations that take a long time. 2021-10-25 11:51:57 -04:00