aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2022-09-12 09:38:07 +0200
committerPeter Eisentraut <peter@eisentraut.org>2022-09-12 09:38:07 +0200
commitc8a1bc01c6b05d394d5b6d0e0f594ccf9b46bbcb (patch)
treebd38ac76a96a0f6783ba37980f0402ca3cf7a0f3 /contrib
parent44a51dc990cc39fcd5ae6359bf1e27bd6699449b (diff)
downloadpostgresql-c8a1bc01c6b05d394d5b6d0e0f594ccf9b46bbcb.tar.gz
postgresql-c8a1bc01c6b05d394d5b6d0e0f594ccf9b46bbcb.zip
Use float8 datatype for percentiles in pg_walinspect stat functions
pg_walinspect uses datatype double (double precision floating point number) for WAL stats percentile calculations and expose them via float4 (single precision floating point number), which an unnecessary loss of precision and confusing. Even though, it's harmless that way, let's use float8 (double precision floating-point number) to be in sync with what pg_walinspect does internally and what it exposes to the users. This seems to be the pattern used elsewhere in the code. Reported-by: Peter Eisentraut Author: Bharath Rupireddy Reviewed-by: Peter Eisentraut Discussion: https://www.postgresql.org/message-id/36ee692b-232f-0484-ce94-dc39d82021ad%40enterprisedb.com
Diffstat (limited to 'contrib')
-rw-r--r--contrib/pg_walinspect/pg_walinspect--1.0.sql16
-rw-r--r--contrib/pg_walinspect/pg_walinspect.c8
2 files changed, 12 insertions, 12 deletions
diff --git a/contrib/pg_walinspect/pg_walinspect--1.0.sql b/contrib/pg_walinspect/pg_walinspect--1.0.sql
index 4243516d8a4..08b3dd55567 100644
--- a/contrib/pg_walinspect/pg_walinspect--1.0.sql
+++ b/contrib/pg_walinspect/pg_walinspect--1.0.sql
@@ -80,13 +80,13 @@ CREATE FUNCTION pg_get_wal_stats(IN start_lsn pg_lsn,
IN per_record boolean DEFAULT false,
OUT "resource_manager/record_type" text,
OUT count int8,
- OUT count_percentage float4,
+ OUT count_percentage float8,
OUT record_size int8,
- OUT record_size_percentage float4,
+ OUT record_size_percentage float8,
OUT fpi_size int8,
- OUT fpi_size_percentage float4,
+ OUT fpi_size_percentage float8,
OUT combined_size int8,
- OUT combined_size_percentage float4
+ OUT combined_size_percentage float8
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pg_get_wal_stats'
@@ -102,13 +102,13 @@ CREATE FUNCTION pg_get_wal_stats_till_end_of_wal(IN start_lsn pg_lsn,
IN per_record boolean DEFAULT false,
OUT "resource_manager/record_type" text,
OUT count int8,
- OUT count_percentage float4,
+ OUT count_percentage float8,
OUT record_size int8,
- OUT record_size_percentage float4,
+ OUT record_size_percentage float8,
OUT fpi_size int8,
- OUT fpi_size_percentage float4,
+ OUT fpi_size_percentage float8,
OUT combined_size int8,
- OUT combined_size_percentage float4
+ OUT combined_size_percentage float8
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pg_get_wal_stats_till_end_of_wal'
diff --git a/contrib/pg_walinspect/pg_walinspect.c b/contrib/pg_walinspect/pg_walinspect.c
index bed01126b5f..68451984300 100644
--- a/contrib/pg_walinspect/pg_walinspect.c
+++ b/contrib/pg_walinspect/pg_walinspect.c
@@ -436,13 +436,13 @@ FillXLogStatsRow(const char *name,
values[i++] = CStringGetTextDatum(name);
values[i++] = Int64GetDatum(n);
- values[i++] = Float4GetDatum(n_pct);
+ values[i++] = Float8GetDatum(n_pct);
values[i++] = Int64GetDatum(rec_len);
- values[i++] = Float4GetDatum(rec_len_pct);
+ values[i++] = Float8GetDatum(rec_len_pct);
values[i++] = Int64GetDatum(fpi_len);
- values[i++] = Float4GetDatum(fpi_len_pct);
+ values[i++] = Float8GetDatum(fpi_len_pct);
values[i++] = Int64GetDatum(tot_len);
- values[i++] = Float4GetDatum(tot_len_pct);
+ values[i++] = Float8GetDatum(tot_len_pct);
Assert(i == ncols);
}