diff --git a/contrib/pg_stat_statements/expected/oldextversions.out b/contrib/pg_stat_statements/expected/oldextversions.out index c2e0140a47..5a5404bbd5 100644 --- a/contrib/pg_stat_statements/expected/oldextversions.out +++ b/contrib/pg_stat_statements/expected/oldextversions.out @@ -286,6 +286,8 @@ AlTER EXTENSION pg_stat_statements UPDATE TO '1.11'; temp_blks_written | bigint | | | shared_blk_read_time | double precision | | | shared_blk_write_time | double precision | | | + local_blk_read_time | double precision | | | + local_blk_write_time | double precision | | | temp_blk_read_time | double precision | | | temp_blk_write_time | double precision | | | wal_records | bigint | | | diff --git a/contrib/pg_stat_statements/pg_stat_statements--1.10--1.11.sql b/contrib/pg_stat_statements/pg_stat_statements--1.10--1.11.sql index 448ef3682f..5fe211184b 100644 --- a/contrib/pg_stat_statements/pg_stat_statements--1.10--1.11.sql +++ b/contrib/pg_stat_statements/pg_stat_statements--1.10--1.11.sql @@ -43,6 +43,8 @@ CREATE FUNCTION pg_stat_statements(IN showtext boolean, OUT temp_blks_written int8, OUT shared_blk_read_time float8, OUT shared_blk_write_time float8, + OUT local_blk_read_time float8, + OUT local_blk_write_time float8, OUT temp_blk_read_time float8, OUT temp_blk_write_time float8, OUT wal_records int8, diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c index 11e6f25b75..baff87b49e 100644 --- a/contrib/pg_stat_statements/pg_stat_statements.c +++ b/contrib/pg_stat_statements/pg_stat_statements.c @@ -184,6 +184,10 @@ typedef struct Counters * in msec */ double shared_blk_write_time; /* time spent writing shared blocks, * in msec */ + double local_blk_read_time; /* time spent reading local blocks, in + * msec */ + double local_blk_write_time; /* time spent writing local blocks, in + * msec */ double temp_blk_read_time; /* time spent reading temp blocks, in msec */ double temp_blk_write_time; /* time spent writing temp blocks, in * msec */ @@ -1395,6 +1399,8 @@ pgss_store(const char *query, uint64 queryId, e->counters.temp_blks_written += bufusage->temp_blks_written; e->counters.shared_blk_read_time += INSTR_TIME_GET_MILLISEC(bufusage->shared_blk_read_time); e->counters.shared_blk_write_time += INSTR_TIME_GET_MILLISEC(bufusage->shared_blk_write_time); + e->counters.local_blk_read_time += INSTR_TIME_GET_MILLISEC(bufusage->local_blk_read_time); + e->counters.local_blk_write_time += INSTR_TIME_GET_MILLISEC(bufusage->local_blk_write_time); e->counters.temp_blk_read_time += INSTR_TIME_GET_MILLISEC(bufusage->temp_blk_read_time); e->counters.temp_blk_write_time += INSTR_TIME_GET_MILLISEC(bufusage->temp_blk_write_time); e->counters.usage += USAGE_EXEC(total_time); @@ -1472,8 +1478,8 @@ pg_stat_statements_reset(PG_FUNCTION_ARGS) #define PG_STAT_STATEMENTS_COLS_V1_8 32 #define PG_STAT_STATEMENTS_COLS_V1_9 33 #define PG_STAT_STATEMENTS_COLS_V1_10 43 -#define PG_STAT_STATEMENTS_COLS_V1_11 45 -#define PG_STAT_STATEMENTS_COLS 45 /* maximum of above */ +#define PG_STAT_STATEMENTS_COLS_V1_11 47 +#define PG_STAT_STATEMENTS_COLS 47 /* maximum of above */ /* * Retrieve statement statistics. @@ -1828,6 +1834,11 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo, values[i++] = Float8GetDatumFast(tmp.shared_blk_read_time); values[i++] = Float8GetDatumFast(tmp.shared_blk_write_time); } + if (api_version >= PGSS_V1_11) + { + values[i++] = Float8GetDatumFast(tmp.local_blk_read_time); + values[i++] = Float8GetDatumFast(tmp.local_blk_write_time); + } if (api_version >= PGSS_V1_10) { values[i++] = Float8GetDatumFast(tmp.temp_blk_read_time); diff --git a/doc/src/sgml/pgstatstatements.sgml b/doc/src/sgml/pgstatstatements.sgml index 2c4e3655ff..6c7ca962f8 100644 --- a/doc/src/sgml/pgstatstatements.sgml +++ b/doc/src/sgml/pgstatstatements.sgml @@ -353,6 +353,26 @@ + + + local_blk_read_time double precision + + + Total time the statement spent reading local blocks, in milliseconds + (if is enabled, otherwise zero) + + + + + + local_blk_write_time double precision + + + Total time the statement spent writing local blocks, in milliseconds + (if is enabled, otherwise zero) + + + temp_blk_read_time double precision