mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
pg_stat_statements: track number of rows processed by some utility commands.
This commit makes pg_stat_statements track the total number of rows retrieved or affected by CREATE TABLE AS, SELECT INTO, CREATE MATERIALIZED VIEW and FETCH commands. Suggested-by: Pascal Legrand Author: Fujii Masao Reviewed-by: Asif Rehman Discussion: https://postgr.es/m/1584293755198-0.post@n3.nabble.com
This commit is contained in:
@ -1170,7 +1170,15 @@ pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||
INSTR_TIME_SET_CURRENT(duration);
|
||||
INSTR_TIME_SUBTRACT(duration, start);
|
||||
|
||||
rows = (qc && qc->commandTag == CMDTAG_COPY) ? qc->nprocessed : 0;
|
||||
/*
|
||||
* Track the total number of rows retrieved or affected by
|
||||
* the utility statements of COPY, FETCH, CREATE TABLE AS,
|
||||
* CREATE MATERIALIZED VIEW and SELECT INTO.
|
||||
*/
|
||||
rows = (qc && (qc->commandTag == CMDTAG_COPY ||
|
||||
qc->commandTag == CMDTAG_FETCH ||
|
||||
qc->commandTag == CMDTAG_SELECT)) ?
|
||||
qc->nprocessed : 0;
|
||||
|
||||
/* calc differences of buffer counters. */
|
||||
memset(&bufusage, 0, sizeof(BufferUsage));
|
||||
|
Reference in New Issue
Block a user