postgresql/contrib/pg_stat_statements/meson.build
Alexander Korotkov dc9f8a7983 Track statement entry timestamp in contrib/pg_stat_statements
This patch adds 'stats_since' and 'minmax_stats_since' columns to the
pg_stat_statements view and pg_stat_statements() function.  The new min/max
reset mode for the pg_stat_stetments_reset() function is controlled by the
parameter minmax_only.

'stat_since' column is populated with the current timestamp when a new
statement is added to the pg_stat_statements hashtable.  It provides clean
information about statistics collection time intervals for each statement.
Besides it can be used by sampling solutions to detect situations when a
statement was evicted and stored again between samples.

Such a sampling solution could derive any pg_stat_statements statistic values
for an interval between two samples with the exception of all min/max
statistics. To address this issue this patch adds the ability to reset
min/max statistics independently of the statement reset using the new
minmax_only parameter of the pg_stat_statements_reset(userid oid, dbid oid,
queryid bigint, minmax_only boolean) function. The timestamp of such reset
is stored in the minmax_stats_since field for each statement.
pg_stat_statements_reset() function now returns the timestamp of a reset as the
result.

Discussion: https://postgr.es/m/flat/72e80e7b160a6eb189df9ef6f068cce3765d37f8.camel%40moonset.ru
Author: Andrei Zubkov
Reviewed-by: Julien Rouhaud, Hayato Kuroda, Yuki Seino, Chengxi Sun
Reviewed-by: Anton Melnikov, Darren Rush, Michael Paquier, Sergei Kornilov
Reviewed-by: Alena Rybakina, Andrei Lepikhov
2023-11-27 02:52:17 +02:00

63 lines
1.7 KiB
Meson

# Copyright (c) 2022-2023, PostgreSQL Global Development Group
pg_stat_statements_sources = files(
'pg_stat_statements.c',
)
if host_system == 'windows'
pg_stat_statements_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
'--NAME', 'pg_stat_statements',
'--FILEDESC', 'pg_stat_statements - execution statistics of SQL statements',])
endif
pg_stat_statements = shared_module('pg_stat_statements',
pg_stat_statements_sources,
kwargs: contrib_mod_args + {
'dependencies': contrib_mod_args['dependencies'],
},
)
contrib_targets += pg_stat_statements
install_data(
'pg_stat_statements.control',
'pg_stat_statements--1.4.sql',
'pg_stat_statements--1.10--1.11.sql',
'pg_stat_statements--1.9--1.10.sql',
'pg_stat_statements--1.8--1.9.sql',
'pg_stat_statements--1.7--1.8.sql',
'pg_stat_statements--1.6--1.7.sql',
'pg_stat_statements--1.5--1.6.sql',
'pg_stat_statements--1.4--1.5.sql',
'pg_stat_statements--1.3--1.4.sql',
'pg_stat_statements--1.2--1.3.sql',
'pg_stat_statements--1.1--1.2.sql',
'pg_stat_statements--1.0--1.1.sql',
kwargs: contrib_data_args,
)
tests += {
'name': 'pg_stat_statements',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'select',
'dml',
'cursors',
'utility',
'level_tracking',
'planning',
'user_activity',
'wal',
'entry_timestamp',
'cleanup',
'oldextversions',
],
'regress_args': ['--temp-config', files('pg_stat_statements.conf')],
# Disabled because these tests require
# "shared_preload_libraries=pg_stat_statements", which typical
# runningcheck users do not have (e.g. buildfarm clients).
'runningcheck': false,
},
}