Skip to content

Commit

Permalink
Issue - (#54): Planning counters require renaming.
Browse files Browse the repository at this point in the history
PG-144 : Changing planing counter name to sync with pg_stat_statment.
  • Loading branch information
ibrarahmad committed Oct 12, 2020
1 parent f48a64c commit ec1ff59
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
13 changes: 6 additions & 7 deletions pg_stat_monitor--1.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ CREATE FUNCTION pg_stat_monitor(IN showtext boolean,
OUT query text,
OUT bucket_start_time timestamptz,

OUT plan_calls int8,
OUT plans int8,
OUT plan_total_time float8,
OUT plan_min_time float8,
OUT plan_max_time float8,
OUT plan_mean_time float8,
OUT plan_stddev_time float8,
OUT plan_rows int8,

OUT total_calls int8,
OUT calls int8,
OUT total_time float8,
OUT min_time float8,
OUT max_time float8,
OUT mean_time float8,
OUT stddev_time float8,
OUT affected_rows int8,
OUT rows int8,

OUT shared_blks_hit int8,
OUT shared_blks_read int8,
Expand Down Expand Up @@ -103,20 +103,19 @@ CREATE VIEW pg_stat_monitor AS SELECT
'0.0.0.0'::inet + client_ip AS client_ip,
queryid,
query,
plan_calls,
plans,
round( CAST(plan_total_time as numeric), 2)::float8 as plan_total_time,
round( CAST(plan_min_time as numeric), 2)::float8 as plan_min_timei,
round( CAST(plan_max_time as numeric), 2)::float8 as plan_max_time,
round( CAST(plan_mean_time as numeric), 2)::float8 as plan_mean_time,
round( CAST(plan_stddev_time as numeric), 2)::float8 as plan_stddev_time,
plan_rows,
total_calls,
calls,
round( CAST(total_time as numeric), 2)::float8 as total_time,
round( CAST(min_time as numeric), 2)::float8 as min_time,
round( CAST(max_time as numeric), 2)::float8 as max_time,
round( CAST(mean_time as numeric), 2)::float8 as mean_time,
round( CAST(stddev_time as numeric), 2)::float8 as stddev_time,
affected_rows,
rows,
shared_blks_hit,
shared_blks_read,
shared_blks_dirtied,
Expand Down
4 changes: 2 additions & 2 deletions pg_stat_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
static uint64 pgss_hash_string(const char *str, int len);
static void pgss_store(const char *query, uint64 queryId,
int query_location, int query_len,
bool kind,
pgssStoreKind kind,
double total_time, uint64 rows,
const BufferUsage *bufusage,
#if PG_VERSION_NUM >= 130000
Expand Down Expand Up @@ -656,7 +656,7 @@ pg_get_client_addr(void)
*/
static void pgss_store(const char *query, uint64 queryId,
int query_location, int query_len,
bool kind,
pgssStoreKind kind,
double total_time, uint64 rows,
const BufferUsage *bufusage,
#if PG_VERSION_NUM >= 130000
Expand Down
2 changes: 2 additions & 0 deletions pg_stat_monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ typedef struct GucVariables
int guc_max;
bool guc_restart;
} GucVariable;

typedef enum pgssStoreKind
{
PGSS_INVALID = -1,
Expand Down Expand Up @@ -195,6 +196,7 @@ typedef struct Counters
CallTime time[PGSS_NUMKIND];
Blocks blocks;
SysInfo sysinfo;
int plans;
int resp_calls[MAX_RESPONSE_BUCKET]; /* execution time's in msec */
} Counters;

Expand Down

0 comments on commit ec1ff59

Please sign in to comment.