postgresql/src/include
Alvaro Herrera 5de890e361
Add EXPLAIN (MEMORY) to report planner memory consumption
This adds a new "Memory:" line under the "Planning:" group (which
currently only has "Buffers:") when the MEMORY option is specified.

In order to make the reporting reasonably accurate, we create a separate
memory context for planner activities, to be used only when this option
is given.  The total amount of memory allocated by that context is
reported as "allocated"; we subtract memory in the context's freelists
from that and report that result as "used".  We use
MemoryContextStatsInternal() to obtain the quantities.

The code structure to show buffer usage during planning was not in
amazing shape, so I (Álvaro) modified the patch a bit to clean that up
in passing.

Author: Ashutosh Bapat
Reviewed-by: David Rowley, Andrey Lepikhov, Jian He, Andy Fan
Discussion: https://www.postgresql.org/message-id/CAExHW5sZA=5LJ_ZPpRO-w09ck8z9p7eaYAqq3Ks9GDfhrxeWBw@mail.gmail.com
2024-01-29 17:53:03 +01:00
..
access Add temporal PRIMARY KEY and UNIQUE constraints 2024-01-24 16:34:37 +01:00
archive Update copyright for 2024 2024-01-03 20:49:05 -05:00
backup Update copyright for 2024 2024-01-03 20:49:05 -05:00
bootstrap Update copyright for 2024 2024-01-03 20:49:05 -05:00
catalog Allow to enable failover property for replication slots via SQL API. 2024-01-25 12:15:46 +05:30
commands Add EXPLAIN (MEMORY) to report planner memory consumption 2024-01-29 17:53:03 +01:00
common Fixed misspelled byteswap function for big endian machines 2024-01-19 13:26:18 +07:00
datatype Update copyright for 2024 2024-01-03 20:49:05 -05:00
executor Add soft error handling to some expression nodes 2024-01-24 15:04:33 +09:00
fe_utils Update copyright for 2024 2024-01-03 20:49:05 -05:00
foreign Update copyright for 2024 2024-01-03 20:49:05 -05:00
jit jit: Require at least LLVM 10. 2024-01-25 15:42:34 +13:00
lib Update copyright for 2024 2024-01-03 20:49:05 -05:00
libpq Make dblink interruptible, via new libpqsrv APIs. 2024-01-08 11:39:56 -08:00
mb Update copyright for 2024 2024-01-03 20:49:05 -05:00
nodes Allow setting failover property in the replication command. 2024-01-29 09:37:23 +05:30
optimizer Add better handling of redundant IS [NOT] NULL quals 2024-01-23 18:09:18 +13:00
parser Add a const decoration 2024-01-25 13:34:49 +01:00
partitioning Update copyright for 2024 2024-01-03 20:49:05 -05:00
pch Update copyright for 2024 2024-01-03 20:49:05 -05:00
port Update copyright for 2024 2024-01-03 20:49:05 -05:00
portability Update copyright for 2024 2024-01-03 20:49:05 -05:00
postmaster Add missing PGDLLIMPORT markings 2024-01-16 13:53:28 +02:00
regex Update copyright for 2024 2024-01-03 20:49:05 -05:00
replication Allow setting failover property in the replication command. 2024-01-29 09:37:23 +05:30
rewrite Update copyright for 2024 2024-01-03 20:49:05 -05:00
snowball Update copyright for 2024 2024-01-03 20:49:05 -05:00
statistics Update copyright for 2024 2024-01-03 20:49:05 -05:00
storage Remove dummy_spinlock 2024-01-25 11:43:47 +01:00
tcop Update copyright for 2024 2024-01-03 20:49:05 -05:00
tsearch Update copyright for 2024 2024-01-03 20:49:05 -05:00
utils Add EXPLAIN (MEMORY) to report planner memory consumption 2024-01-29 17:53:03 +01:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
Makefile Fix makefiles for newly added files 2024-01-23 16:33:26 +01:00
c.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
fmgr.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
funcapi.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
getopt_long.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
miscadmin.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_config.h.in jit: Require at least LLVM 10. 2024-01-25 15:42:34 +13:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.meson meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
pg_config_manual.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_getopt.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_trace.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgstat.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgtar.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgtime.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
port.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
postgres.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
postgres_ext.h Move RelFileNumber declarations to common/relpath.h. 2022-09-27 12:01:57 -04:00
postgres_fe.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
varatt.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
windowapi.h Update copyright for 2024 2024-01-03 20:49:05 -05:00