1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-18 17:42:25 +03:00

Turn PGBE_ACTIVITY_SIZE into a GUC variable, track_activity_query_size.

As the buffer could now be a lot larger than before, and copying it could
thus be a lot more expensive than before, use strcpy instead of memcpy to
copy the query string, as was already suggested in comments. Also, only copy
the PgBackendStatus struct and string if the slot is in use.

Patch by Thomas Lee, with some changes by me.
This commit is contained in:
Heikki Linnakangas
2008-06-30 10:58:47 +00:00
parent 7ea9b997ef
commit 995fb74202
5 changed files with 77 additions and 18 deletions

View File

@ -5,7 +5,7 @@
*
* Copyright (c) 2001-2008, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/include/pgstat.h,v 1.76 2008/06/19 00:46:05 alvherre Exp $
* $PostgreSQL: pgsql/src/include/pgstat.h,v 1.77 2008/06/30 10:58:47 heikki Exp $
* ----------
*/
#ifndef PGSTAT_H
@ -509,9 +509,6 @@ typedef struct PgStat_GlobalStats
* ----------
*/
/* Max length of st_activity string ... perhaps replace with a GUC var? */
#define PGBE_ACTIVITY_SIZE 1024
/* ----------
* PgBackendStatus
*
@ -551,7 +548,7 @@ typedef struct PgBackendStatus
bool st_waiting;
/* current command string; MUST be null-terminated */
char st_activity[PGBE_ACTIVITY_SIZE];
char *st_activity;
} PgBackendStatus;
/*
@ -578,6 +575,7 @@ typedef struct PgStat_FunctionCallUsage
extern bool pgstat_track_activities;
extern bool pgstat_track_counts;
extern int pgstat_track_functions;
extern int pgstat_track_activity_query_size;
/*
* BgWriter statistics counters are updated directly by bgwriter and bufmgr