From fe23d31bf99f9ac369a90503428c55337bdcbc93 Mon Sep 17 00:00:00 2001 From: Muhammad Usama Date: Thu, 23 Feb 2023 21:24:40 +0500 Subject: [PATCH] PG-607: Allow histogram to track queries in sub-ms time brackets (#384) * PG-607: Allow histogram to track queries in sub-ms time brackets Updated the GUC configuration and the relevant histogram functionality to track queries in lower cardinality than ms. This is done by saving the GUC values for histogram min and max values in real (double) type. All test cases except for the 030 tap test are passing. The test case needs an update. * Fixing regression issues for v12 and below because of histogram changes. --- guc.c | 35 ++++++++++--------- pg_stat_monitor.c | 22 ++++++------ pg_stat_monitor.h | 6 ++-- regression/expected/guc.out | 6 ++-- regression/expected/guc_1.out | 6 ++-- t/expected/001_settings_default.out | 12 +++---- t/expected/001_settings_default.out.12 | 12 +++---- .../009_settings_pgsm_histogram_max.out | 18 +++++----- .../010_settings_pgsm_histogram_min.out | 18 +++++----- t/expected/011_settings_pgsm_bucket_time.out | 12 +++---- 10 files changed, 74 insertions(+), 73 deletions(-) diff --git a/guc.c b/guc.c index 7a2ef9117341..7ea2c024452e 100644 --- a/guc.c +++ b/guc.c @@ -24,8 +24,8 @@ int pgsm_query_max_len; int pgsm_bucket_time; int pgsm_max_buckets; int pgsm_histogram_buckets; -int pgsm_histogram_max; -int pgsm_histogram_min; +double pgsm_histogram_min; +double pgsm_histogram_max; int pgsm_query_shared_buffer; bool pgsm_track_planning; bool pgsm_extract_comments; @@ -38,8 +38,8 @@ int pgsm_track; static int pgsm_overflow_target; /* Not used since 2.0 */ /* Check hooks to ensure histogram_min < histogram_max */ -static bool check_histogram_min(int *newval, void **extra, GucSource source); -static bool check_histogram_max(int *newval, void **extra, GucSource source); +static bool check_histogram_min(double *newval, void **extra, GucSource source); +static bool check_histogram_max(double *newval, void **extra, GucSource source); static bool check_overflow_targer(int *newval, void **extra, GucSource source); /* * Define (or redefine) custom GUC variables. @@ -98,35 +98,35 @@ init_guc(void) 1, /* min value */ INT_MAX, /* max value */ PGC_POSTMASTER, /* context */ - 0, /* flags */ + GUC_UNIT_S, /* flags */ NULL, /* check_hook */ NULL, /* assign_hook */ NULL /* show_hook */ ); - DefineCustomIntVariable("pg_stat_monitor.pgsm_histogram_min", /* name */ + DefineCustomRealVariable("pg_stat_monitor.pgsm_histogram_min", /* name */ "Sets the time in millisecond.", /* short_desc */ NULL, /* long_desc */ &pgsm_histogram_min, /* value address */ 1, /* boot value */ 0, /* min value */ - INT_MAX, /* max value */ + HISTOGRAM_MAX_TIME, /* max value */ PGC_POSTMASTER, /* context */ - 0, /* flags */ + GUC_UNIT_MS, /* flags */ check_histogram_min, /* check_hook */ NULL, /* assign_hook */ NULL /* show_hook */ ); - DefineCustomIntVariable("pg_stat_monitor.pgsm_histogram_max", /* name */ + DefineCustomRealVariable("pg_stat_monitor.pgsm_histogram_max", /* name */ "Sets the time in millisecond.", /* short_desc */ NULL, /* long_desc */ &pgsm_histogram_max, /* value address */ - 100000, /* boot value */ - 10, /* min value */ - INT_MAX, /* max value */ + 100000.0, /* boot value */ + 10.0, /* min value */ + HISTOGRAM_MAX_TIME, /* max value */ PGC_POSTMASTER, /* context */ - 0, /* flags */ + GUC_UNIT_MS, /* flags */ check_histogram_max, /* check_hook */ NULL, /* assign_hook */ NULL /* show_hook */ @@ -276,20 +276,21 @@ init_guc(void) } +/* Maximum value must be greater or equal to minimum + 1.0 */ static bool -check_histogram_min(int *newval, void **extra, GucSource source) +check_histogram_min(double *newval, void **extra, GucSource source) { /* * During module initialization PGSM_HISTOGRAM_MIN is initialized before * PGSM_HISTOGRAM_MAX, in this case PGSM_HISTOGRAM_MAX will be zero. */ - return (pgsm_histogram_max == 0 || *newval < pgsm_histogram_max); + return (pgsm_histogram_max == 0 || (*newval + 1.0) <= pgsm_histogram_max); } static bool -check_histogram_max(int *newval, void **extra, GucSource source) +check_histogram_max(double *newval, void **extra, GucSource source) { - return (*newval > pgsm_histogram_min); + return (*newval >= (pgsm_histogram_min + 1.0)); } static bool diff --git a/pg_stat_monitor.c b/pg_stat_monitor.c index 8a52c1864b2a..7dee9e60747c 100644 --- a/pg_stat_monitor.c +++ b/pg_stat_monitor.c @@ -82,9 +82,9 @@ static int plan_nested_level = 0; /* Histogram bucket variables */ static double hist_bucket_min; static double hist_bucket_max; +static double hist_bucket_timings[MAX_RESPONSE_BUCKET + 2][2]; /* Start and end timings */ static int hist_bucket_count_user; static int hist_bucket_count_total; -int64 hist_bucket_timings[MAX_RESPONSE_BUCKET + 2][2]; /* Start and end timings */ static uint32 pgsm_client_ip = PGSM_INVALID_IP_MASK; @@ -112,7 +112,7 @@ static char *pgsm_explain(QueryDesc *queryDesc); static void extract_query_comments(const char *query, char *comments, size_t max_len); static void set_histogram_bucket_timings(void); -static void histogram_bucket_timings(int index, int64 *b_start, int64 *b_end); +static void histogram_bucket_timings(int index, double *b_start, double *b_end); static int get_histogram_bucket(double q_time); static bool IsSystemInitialized(void); @@ -3545,8 +3545,8 @@ unpack_sql_state(int sql_state) static void set_histogram_bucket_timings(void) { - int64 b2_start; - int64 b2_end; + double b2_start; + double b2_end; int b_count; hist_bucket_min = pgsm_histogram_min; @@ -3596,7 +3596,7 @@ set_histogram_bucket_timings(void) * Given an index, return the histogram start and end times. */ static void -histogram_bucket_timings(int index, int64 *b_start, int64 *b_end) +histogram_bucket_timings(int index, double *b_start, double *b_end) { double q_min = hist_bucket_min; double q_max = hist_bucket_max; @@ -3640,7 +3640,7 @@ static int get_histogram_bucket(double q_time) { int index = 0; - int64 exec_time = (int64)q_time; + double exec_time = q_time; for (index = 0; index < hist_bucket_count_total; index++) { @@ -3662,8 +3662,8 @@ get_histogram_bucket(double q_time) Datum get_histogram_timings(PG_FUNCTION_ARGS) { - int64 b_start; - int64 b_end; + double b_start; + double b_end; int b_count = hist_bucket_count_total; int index = 0; char *tmp_str = palloc0(MAX_STRING_LEN); @@ -3675,16 +3675,16 @@ get_histogram_timings(PG_FUNCTION_ARGS) if (index == 0) { - snprintf(text_str, MAX_STRING_LEN, "{{%ld - %ld}", b_start, b_end); + snprintf(text_str, MAX_STRING_LEN, "{{%.3lf - %.3lf}", b_start, b_end); } else if (index == (b_count - 1)) { - snprintf(tmp_str, MAX_STRING_LEN, "%s, (%ld - ...}}", text_str, b_start); + snprintf(tmp_str, MAX_STRING_LEN, "%s, (%.3lf - ...}}", text_str, b_start); snprintf(text_str, MAX_STRING_LEN, "%s", tmp_str); } else { - snprintf(tmp_str, MAX_STRING_LEN, "%s, (%ld - %ld}", text_str, b_start, b_end); + snprintf(tmp_str, MAX_STRING_LEN, "%s, (%.3lf - %.3lf}", text_str, b_start, b_end); snprintf(text_str, MAX_STRING_LEN, "%s", tmp_str); } } diff --git a/pg_stat_monitor.h b/pg_stat_monitor.h index b9a925f7dff5..6d99d6c76655 100644 --- a/pg_stat_monitor.h +++ b/pg_stat_monitor.h @@ -74,7 +74,7 @@ #define JUMBLE_SIZE 1024 /* query serialization buffer size */ -#define HISTOGRAM_MAX_TIME INT_MAX +#define HISTOGRAM_MAX_TIME 50000000 #define MAX_RESPONSE_BUCKET 50 #define INVALID_BUCKET_ID -1 #define MAX_BUCKETS 10 @@ -506,8 +506,8 @@ extern int pgsm_query_max_len; extern int pgsm_bucket_time; extern int pgsm_max_buckets; extern int pgsm_histogram_buckets; -extern int pgsm_histogram_max; -extern int pgsm_histogram_min; +extern double pgsm_histogram_min; +extern double pgsm_histogram_max; extern int pgsm_query_shared_buffer; extern bool pgsm_track_planning; extern bool pgsm_extract_comments; diff --git a/regression/expected/guc.out b/regression/expected/guc.out index 6f9222490558..dd84374f9c57 100644 --- a/regression/expected/guc.out +++ b/regression/expected/guc.out @@ -18,14 +18,14 @@ BY name COLLATE "C"; name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart -------------------------------------------+---------+------+------------+---------+---------+---------+------------+----------------+----------+-----------+----------------- - pg_stat_monitor.pgsm_bucket_time | 60 | | postmaster | integer | default | 1 | 2147483647 | | 60 | 60 | f + pg_stat_monitor.pgsm_bucket_time | 60 | s | postmaster | integer | default | 1 | 2147483647 | | 60 | 60 | f pg_stat_monitor.pgsm_enable_overflow | on | | postmaster | bool | default | | | | on | on | f pg_stat_monitor.pgsm_enable_pgsm_query_id | on | | user | bool | default | | | | on | on | f pg_stat_monitor.pgsm_enable_query_plan | off | | user | bool | default | | | | off | off | f pg_stat_monitor.pgsm_extract_comments | off | | user | bool | default | | | | off | off | f pg_stat_monitor.pgsm_histogram_buckets | 20 | | postmaster | integer | default | 2 | 50 | | 20 | 20 | f - pg_stat_monitor.pgsm_histogram_max | 100000 | | postmaster | integer | default | 10 | 2147483647 | | 100000 | 100000 | f - pg_stat_monitor.pgsm_histogram_min | 1 | | postmaster | integer | default | 0 | 2147483647 | | 1 | 1 | f + pg_stat_monitor.pgsm_histogram_max | 100000 | ms | postmaster | real | default | 10 | 5e+07 | | 100000 | 100000 | f + pg_stat_monitor.pgsm_histogram_min | 1 | ms | postmaster | real | default | 0 | 5e+07 | | 1 | 1 | f pg_stat_monitor.pgsm_max | 256 | MB | postmaster | integer | default | 10 | 10240 | | 256 | 256 | f pg_stat_monitor.pgsm_max_buckets | 10 | | postmaster | integer | default | 1 | 20000 | | 10 | 10 | f pg_stat_monitor.pgsm_normalized_query | off | | user | bool | default | | | | off | off | f diff --git a/regression/expected/guc_1.out b/regression/expected/guc_1.out index a1fa10b536d0..6c73f2ed1c54 100644 --- a/regression/expected/guc_1.out +++ b/regression/expected/guc_1.out @@ -18,14 +18,14 @@ BY name COLLATE "C"; name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart -------------------------------------------+---------+------+------------+---------+---------+---------+------------+----------------+----------+-----------+----------------- - pg_stat_monitor.pgsm_bucket_time | 60 | | postmaster | integer | default | 1 | 2147483647 | | 60 | 60 | f + pg_stat_monitor.pgsm_bucket_time | 60 | s | postmaster | integer | default | 1 | 2147483647 | | 60 | 60 | f pg_stat_monitor.pgsm_enable_overflow | on | | postmaster | bool | default | | | | on | on | f pg_stat_monitor.pgsm_enable_pgsm_query_id | on | | user | bool | default | | | | on | on | f pg_stat_monitor.pgsm_enable_query_plan | off | | user | bool | default | | | | off | off | f pg_stat_monitor.pgsm_extract_comments | off | | user | bool | default | | | | off | off | f pg_stat_monitor.pgsm_histogram_buckets | 20 | | postmaster | integer | default | 2 | 50 | | 20 | 20 | f - pg_stat_monitor.pgsm_histogram_max | 100000 | | postmaster | integer | default | 10 | 2147483647 | | 100000 | 100000 | f - pg_stat_monitor.pgsm_histogram_min | 1 | | postmaster | integer | default | 0 | 2147483647 | | 1 | 1 | f + pg_stat_monitor.pgsm_histogram_max | 100000 | ms | postmaster | real | default | 10 | 5e+07 | | 100000 | 100000 | f + pg_stat_monitor.pgsm_histogram_min | 1 | ms | postmaster | real | default | 0 | 5e+07 | | 1 | 1 | f pg_stat_monitor.pgsm_max | 256 | MB | postmaster | integer | default | 10 | 10240 | | 256 | 256 | f pg_stat_monitor.pgsm_max_buckets | 10 | | postmaster | integer | default | 1 | 20000 | | 10 | 10 | f pg_stat_monitor.pgsm_normalized_query | off | | user | bool | default | | | | off | off | f diff --git a/t/expected/001_settings_default.out b/t/expected/001_settings_default.out index 3aa2c77be857..5a99aeedce79 100644 --- a/t/expected/001_settings_default.out +++ b/t/expected/001_settings_default.out @@ -8,14 +8,14 @@ SELECT pg_stat_monitor_reset(); SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name LIKE '%pg_stat_monitor%'; name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart -------------------------------------------+---------+------+------------+---------+---------+---------+------------+----------------+----------+-----------+----------------- - pg_stat_monitor.pgsm_bucket_time | 60 | | postmaster | integer | default | 1 | 2147483647 | | 60 | 60 | f + pg_stat_monitor.pgsm_bucket_time | 60 | s | postmaster | integer | default | 1 | 2147483647 | | 60 | 60 | f pg_stat_monitor.pgsm_enable_overflow | on | | postmaster | bool | default | | | | on | on | f pg_stat_monitor.pgsm_enable_pgsm_query_id | on | | user | bool | default | | | | on | on | f pg_stat_monitor.pgsm_enable_query_plan | off | | user | bool | default | | | | off | off | f pg_stat_monitor.pgsm_extract_comments | off | | user | bool | default | | | | off | off | f pg_stat_monitor.pgsm_histogram_buckets | 20 | | postmaster | integer | default | 2 | 50 | | 20 | 20 | f - pg_stat_monitor.pgsm_histogram_max | 100000 | | postmaster | integer | default | 10 | 2147483647 | | 100000 | 100000 | f - pg_stat_monitor.pgsm_histogram_min | 1 | | postmaster | integer | default | 0 | 2147483647 | | 1 | 1 | f + pg_stat_monitor.pgsm_histogram_max | 100000 | ms | postmaster | real | default | 10 | 5e+07 | | 100000 | 100000 | f + pg_stat_monitor.pgsm_histogram_min | 1 | ms | postmaster | real | default | 0 | 5e+07 | | 1 | 1 | f pg_stat_monitor.pgsm_max | 256 | MB | postmaster | integer | default | 10 | 10240 | | 256 | 256 | f pg_stat_monitor.pgsm_max_buckets | 10 | | postmaster | integer | default | 1 | 20000 | | 10 | 10 | f pg_stat_monitor.pgsm_normalized_query | off | | user | bool | default | | | | off | off | f @@ -37,14 +37,14 @@ SELECT datname, substr(query,0,100) AS query, calls FROM pg_stat_monitor ORDER B SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name LIKE '%pg_stat_monitor%'; name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart -------------------------------------------+---------+------+------------+---------+---------+---------+------------+----------------+----------+-----------+----------------- - pg_stat_monitor.pgsm_bucket_time | 60 | | postmaster | integer | default | 1 | 2147483647 | | 60 | 60 | f + pg_stat_monitor.pgsm_bucket_time | 60 | s | postmaster | integer | default | 1 | 2147483647 | | 60 | 60 | f pg_stat_monitor.pgsm_enable_overflow | on | | postmaster | bool | default | | | | on | on | f pg_stat_monitor.pgsm_enable_pgsm_query_id | on | | user | bool | default | | | | on | on | f pg_stat_monitor.pgsm_enable_query_plan | off | | user | bool | default | | | | off | off | f pg_stat_monitor.pgsm_extract_comments | off | | user | bool | default | | | | off | off | f pg_stat_monitor.pgsm_histogram_buckets | 20 | | postmaster | integer | default | 2 | 50 | | 20 | 20 | f - pg_stat_monitor.pgsm_histogram_max | 100000 | | postmaster | integer | default | 10 | 2147483647 | | 100000 | 100000 | f - pg_stat_monitor.pgsm_histogram_min | 1 | | postmaster | integer | default | 0 | 2147483647 | | 1 | 1 | f + pg_stat_monitor.pgsm_histogram_max | 100000 | ms | postmaster | real | default | 10 | 5e+07 | | 100000 | 100000 | f + pg_stat_monitor.pgsm_histogram_min | 1 | ms | postmaster | real | default | 0 | 5e+07 | | 1 | 1 | f pg_stat_monitor.pgsm_max | 256 | MB | postmaster | integer | default | 10 | 10240 | | 256 | 256 | f pg_stat_monitor.pgsm_max_buckets | 10 | | postmaster | integer | default | 1 | 20000 | | 10 | 10 | f pg_stat_monitor.pgsm_normalized_query | off | | user | bool | default | | | | off | off | f diff --git a/t/expected/001_settings_default.out.12 b/t/expected/001_settings_default.out.12 index afe1b102fa0e..4933ae9ed7cd 100644 --- a/t/expected/001_settings_default.out.12 +++ b/t/expected/001_settings_default.out.12 @@ -8,14 +8,14 @@ SELECT pg_stat_monitor_reset(); SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name LIKE '%pg_stat_monitor%'; name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart -------------------------------------------+---------+------+------------+---------+---------+---------+------------+----------------+----------+-----------+----------------- - pg_stat_monitor.pgsm_bucket_time | 60 | | postmaster | integer | default | 1 | 2147483647 | | 60 | 60 | f + pg_stat_monitor.pgsm_bucket_time | 60 | s | postmaster | integer | default | 1 | 2147483647 | | 60 | 60 | f pg_stat_monitor.pgsm_enable_overflow | on | | postmaster | bool | default | | | | on | on | f pg_stat_monitor.pgsm_enable_pgsm_query_id | on | | user | bool | default | | | | on | on | f pg_stat_monitor.pgsm_enable_query_plan | off | | user | bool | default | | | | off | off | f pg_stat_monitor.pgsm_extract_comments | off | | user | bool | default | | | | off | off | f pg_stat_monitor.pgsm_histogram_buckets | 20 | | postmaster | integer | default | 2 | 50 | | 20 | 20 | f - pg_stat_monitor.pgsm_histogram_max | 100000 | | postmaster | integer | default | 10 | 2147483647 | | 100000 | 100000 | f - pg_stat_monitor.pgsm_histogram_min | 1 | | postmaster | integer | default | 0 | 2147483647 | | 1 | 1 | f + pg_stat_monitor.pgsm_histogram_max | 100000 | ms | postmaster | real | default | 10 | 5e+07 | | 100000 | 100000 | f + pg_stat_monitor.pgsm_histogram_min | 1 | ms | postmaster | real | default | 0 | 5e+07 | | 1 | 1 | f pg_stat_monitor.pgsm_max | 256 | MB | postmaster | integer | default | 10 | 10240 | | 256 | 256 | f pg_stat_monitor.pgsm_max_buckets | 10 | | postmaster | integer | default | 1 | 20000 | | 10 | 10 | f pg_stat_monitor.pgsm_normalized_query | off | | user | bool | default | | | | off | off | f @@ -36,14 +36,14 @@ SELECT datname, substr(query,0,100) AS query, calls FROM pg_stat_monitor ORDER B SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name LIKE '%pg_stat_monitor%'; name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart -------------------------------------------+---------+------+------------+---------+---------+---------+------------+----------------+----------+-----------+----------------- - pg_stat_monitor.pgsm_bucket_time | 60 | | postmaster | integer | default | 1 | 2147483647 | | 60 | 60 | f + pg_stat_monitor.pgsm_bucket_time | 60 | s | postmaster | integer | default | 1 | 2147483647 | | 60 | 60 | f pg_stat_monitor.pgsm_enable_overflow | on | | postmaster | bool | default | | | | on | on | f pg_stat_monitor.pgsm_enable_pgsm_query_id | on | | user | bool | default | | | | on | on | f pg_stat_monitor.pgsm_enable_query_plan | off | | user | bool | default | | | | off | off | f pg_stat_monitor.pgsm_extract_comments | off | | user | bool | default | | | | off | off | f pg_stat_monitor.pgsm_histogram_buckets | 20 | | postmaster | integer | default | 2 | 50 | | 20 | 20 | f - pg_stat_monitor.pgsm_histogram_max | 100000 | | postmaster | integer | default | 10 | 2147483647 | | 100000 | 100000 | f - pg_stat_monitor.pgsm_histogram_min | 1 | | postmaster | integer | default | 0 | 2147483647 | | 1 | 1 | f + pg_stat_monitor.pgsm_histogram_max | 100000 | ms | postmaster | real | default | 10 | 5e+07 | | 100000 | 100000 | f + pg_stat_monitor.pgsm_histogram_min | 1 | ms | postmaster | real | default | 0 | 5e+07 | | 1 | 1 | f pg_stat_monitor.pgsm_max | 256 | MB | postmaster | integer | default | 10 | 10240 | | 256 | 256 | f pg_stat_monitor.pgsm_max_buckets | 10 | | postmaster | integer | default | 1 | 20000 | | 10 | 10 | f pg_stat_monitor.pgsm_normalized_query | off | | user | bool | default | | | | off | off | f diff --git a/t/expected/009_settings_pgsm_histogram_max.out b/t/expected/009_settings_pgsm_histogram_max.out index 17c9caa2a79b..6f6a5b5ef1ee 100644 --- a/t/expected/009_settings_pgsm_histogram_max.out +++ b/t/expected/009_settings_pgsm_histogram_max.out @@ -6,9 +6,9 @@ SELECT pg_stat_monitor_reset(); (1 row) SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_histogram_max'; - name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart -------------------------------------+---------+------+------------+---------+---------+---------+------------+----------+----------+-----------+----------------- - pg_stat_monitor.pgsm_histogram_max | 100000 | | postmaster | integer | default | 10 | 2147483647 | | 100000 | 100000 | f + name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart +------------------------------------+---------+------+------------+---------+---------+---------+---------+----------+----------+-----------+----------------- + pg_stat_monitor.pgsm_histogram_max | 100000 | ms | postmaster | real | default | 10 | 5e+07 | | 100000 | 100000 | f (1 row) SELECT pg_stat_monitor_reset(); @@ -18,9 +18,9 @@ SELECT pg_stat_monitor_reset(); (1 row) SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_histogram_max'; - name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart -------------------------------------+---------+------+------------+---------+--------------------+---------+------------+----------+----------+-----------+----------------- - pg_stat_monitor.pgsm_histogram_max | 50 | | postmaster | integer | configuration file | 10 | 2147483647 | | 100000 | 50 | f + name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart +------------------------------------+---------+------+------------+---------+--------------------+---------+---------+----------+----------+-----------+----------------- + pg_stat_monitor.pgsm_histogram_max | 50 | ms | postmaster | real | configuration file | 10 | 5e+07 | | 100000 | 50 | f (1 row) SELECT pg_stat_monitor_reset(); @@ -30,9 +30,9 @@ SELECT pg_stat_monitor_reset(); (1 row) SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_histogram_max'; - name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart -------------------------------------+---------+------+------------+---------+--------------------+---------+------------+----------+----------+-----------+----------------- - pg_stat_monitor.pgsm_histogram_max | 1000 | | postmaster | integer | configuration file | 10 | 2147483647 | | 100000 | 1000 | f + name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart +------------------------------------+---------+------+------------+---------+--------------------+---------+---------+----------+----------+-----------+----------------- + pg_stat_monitor.pgsm_histogram_max | 1000 | ms | postmaster | real | configuration file | 10 | 5e+07 | | 100000 | 1000 | f (1 row) DROP EXTENSION pg_stat_monitor; diff --git a/t/expected/010_settings_pgsm_histogram_min.out b/t/expected/010_settings_pgsm_histogram_min.out index dfb7f09c182d..f4cb5fd9f516 100644 --- a/t/expected/010_settings_pgsm_histogram_min.out +++ b/t/expected/010_settings_pgsm_histogram_min.out @@ -6,9 +6,9 @@ SELECT pg_stat_monitor_reset(); (1 row) SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_histogram_min'; - name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart -------------------------------------+---------+------+------------+---------+--------------------+---------+------------+----------+----------+-----------+----------------- - pg_stat_monitor.pgsm_histogram_min | 1 | | postmaster | integer | configuration file | 0 | 2147483647 | | 1 | 1 | f + name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart +------------------------------------+---------+------+------------+---------+--------------------+---------+---------+----------+----------+-----------+----------------- + pg_stat_monitor.pgsm_histogram_min | 1 | ms | postmaster | real | configuration file | 0 | 5e+07 | | 1 | 1 | f (1 row) SELECT pg_stat_monitor_reset(); @@ -18,9 +18,9 @@ SELECT pg_stat_monitor_reset(); (1 row) SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_histogram_min'; - name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart -------------------------------------+---------+------+------------+---------+--------------------+---------+------------+----------+----------+-----------+----------------- - pg_stat_monitor.pgsm_histogram_min | 20 | | postmaster | integer | configuration file | 0 | 2147483647 | | 1 | 20 | f + name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart +------------------------------------+---------+------+------------+---------+--------------------+---------+---------+----------+----------+-----------+----------------- + pg_stat_monitor.pgsm_histogram_min | 20 | ms | postmaster | real | configuration file | 0 | 5e+07 | | 1 | 20 | f (1 row) SELECT pg_stat_monitor_reset(); @@ -30,9 +30,9 @@ SELECT pg_stat_monitor_reset(); (1 row) SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_histogram_min'; - name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart -------------------------------------+---------+------+------------+---------+--------------------+---------+------------+----------+----------+-----------+----------------- - pg_stat_monitor.pgsm_histogram_min | 100 | | postmaster | integer | configuration file | 0 | 2147483647 | | 1 | 100 | f + name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart +------------------------------------+---------+------+------------+---------+--------------------+---------+---------+----------+----------+-----------+----------------- + pg_stat_monitor.pgsm_histogram_min | 100 | ms | postmaster | real | configuration file | 0 | 5e+07 | | 1 | 100 | f (1 row) DROP EXTENSION pg_stat_monitor; diff --git a/t/expected/011_settings_pgsm_bucket_time.out b/t/expected/011_settings_pgsm_bucket_time.out index f0519e90ea6a..6a6d1f1c3749 100644 --- a/t/expected/011_settings_pgsm_bucket_time.out +++ b/t/expected/011_settings_pgsm_bucket_time.out @@ -8,7 +8,7 @@ SELECT pg_stat_monitor_reset(); SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_bucket_time'; name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart ----------------------------------+---------+------+------------+---------+--------------------+---------+------------+----------+----------+-----------+----------------- - pg_stat_monitor.pgsm_bucket_time | 10000 | | postmaster | integer | configuration file | 1 | 2147483647 | | 60 | 10000 | f + pg_stat_monitor.pgsm_bucket_time | 10000 | s | postmaster | integer | configuration file | 1 | 2147483647 | | 60 | 10000 | f (1 row) SELECT pg_stat_monitor_reset(); @@ -20,7 +20,7 @@ SELECT pg_stat_monitor_reset(); SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_bucket_time'; name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart ----------------------------------+---------+------+------------+---------+--------------------+---------+------------+----------+----------+-----------+----------------- - pg_stat_monitor.pgsm_bucket_time | 1000 | | postmaster | integer | configuration file | 1 | 2147483647 | | 60 | 1000 | f + pg_stat_monitor.pgsm_bucket_time | 1000 | s | postmaster | integer | configuration file | 1 | 2147483647 | | 60 | 1000 | f (1 row) SELECT pg_stat_monitor_reset(); @@ -32,7 +32,7 @@ SELECT pg_stat_monitor_reset(); SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_bucket_time'; name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart ----------------------------------+---------+------+------------+---------+--------------------+---------+------------+----------+----------+-----------+----------------- - pg_stat_monitor.pgsm_bucket_time | 100 | | postmaster | integer | configuration file | 1 | 2147483647 | | 60 | 100 | f + pg_stat_monitor.pgsm_bucket_time | 100 | s | postmaster | integer | configuration file | 1 | 2147483647 | | 60 | 100 | f (1 row) SELECT pg_stat_monitor_reset(); @@ -44,7 +44,7 @@ SELECT pg_stat_monitor_reset(); SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_bucket_time'; name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart ----------------------------------+---------+------+------------+---------+--------------------+---------+------------+----------+----------+-----------+----------------- - pg_stat_monitor.pgsm_bucket_time | 60 | | postmaster | integer | configuration file | 1 | 2147483647 | | 60 | 60 | f + pg_stat_monitor.pgsm_bucket_time | 60 | s | postmaster | integer | configuration file | 1 | 2147483647 | | 60 | 60 | f (1 row) SELECT pg_stat_monitor_reset(); @@ -56,7 +56,7 @@ SELECT pg_stat_monitor_reset(); SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_bucket_time'; name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart ----------------------------------+---------+------+------------+---------+--------------------+---------+------------+----------+----------+-----------+----------------- - pg_stat_monitor.pgsm_bucket_time | 1 | | postmaster | integer | configuration file | 1 | 2147483647 | | 60 | 1 | f + pg_stat_monitor.pgsm_bucket_time | 1 | s | postmaster | integer | configuration file | 1 | 2147483647 | | 60 | 1 | f (1 row) SELECT pg_stat_monitor_reset(); @@ -68,7 +68,7 @@ SELECT pg_stat_monitor_reset(); SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_bucket_time'; name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart ----------------------------------+---------+------+------------+---------+---------+---------+------------+----------+----------+-----------+----------------- - pg_stat_monitor.pgsm_bucket_time | 60 | | postmaster | integer | default | 1 | 2147483647 | | 60 | 60 | f + pg_stat_monitor.pgsm_bucket_time | 60 | s | postmaster | integer | default | 1 | 2147483647 | | 60 | 60 | f (1 row) DROP EXTENSION pg_stat_monitor;