PG-562: Histogram Ranges/Buckets are not correct.

Added buckets for queries that take less than minimum histogram time
and one for the ones taking more than the max value specified.

Also, in case the buckets end up overlapping, on server start, an
error will be thrown informing the user of this issue and requesting
a rectification.

Refactored the code to consolidate the calculations in a single
function.
This commit is contained in:
Hamid Akhtar
2023-01-19 05:39:37 +05:00
committed by Muhammad Usama
parent 1286427445
commit 209f370cef
8 changed files with 109 additions and 92 deletions

View File

@@ -63,7 +63,7 @@ SELECT
$$
LANGUAGE SQL PARALLEL SAFE;
CREATE FUNCTION histogram(_bucket int, _quryid text)
CREATE FUNCTION histogram(_bucket int, _quryid int8)
RETURNS SETOF RECORD AS $$
DECLARE
rec record;
@@ -463,4 +463,3 @@ REVOKE ALL ON FUNCTION pgsm_create_14_view FROM PUBLIC;
REVOKE ALL ON FUNCTION pgsm_create_15_view FROM PUBLIC;
GRANT SELECT ON pg_stat_monitor TO PUBLIC;