1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-12 21:01:52 +03:00

Delay write of pg_stats file to once every five minutes, during

shutdown, or when requested by a backend:

It changes so the file is only written once every 5 minutes (changeable
of course, I just picked something) instead of once every half second.
It's still written when the stats collector shuts down, just as before.
And it is now also written on backend request. A backend requests a
rewrite by simply sending a special stats message. It operates on the
assumption that the backends aren't actually going to read the
statistics file very often, compared to how frequent it's written today.

Magnus Hagander
This commit is contained in:
Bruce Momjian
2006-04-27 00:06:59 +00:00
parent a1e5331b07
commit 944a17bf9f
2 changed files with 121 additions and 14 deletions

View File

@ -5,7 +5,7 @@
*
* Copyright (c) 2001-2006, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/include/pgstat.h,v 1.43 2006/04/06 20:38:00 tgl Exp $
* $PostgreSQL: pgsql/src/include/pgstat.h,v 1.44 2006/04/27 00:06:59 momjian Exp $
* ----------
*/
#ifndef PGSTAT_H
@ -32,7 +32,8 @@ typedef enum StatMsgType
PGSTAT_MTYPE_RESETCOUNTER,
PGSTAT_MTYPE_AUTOVAC_START,
PGSTAT_MTYPE_VACUUM,
PGSTAT_MTYPE_ANALYZE
PGSTAT_MTYPE_ANALYZE,
PGSTAT_MTYPE_REWRITE
} StatMsgType;
/* ----------
@ -107,6 +108,15 @@ typedef struct PgStat_MsgDummy
char m_dummy[512];
} PgStat_MsgDummy;
/* ----------
* PgStat_MsgRewrite Sent by backends to cause a rewrite of the stats file
* ----------
*/
typedef struct Pgstat_MsgRewrite
{
PgStat_MsgHdr m_hdr;
} PgStat_MsgRewrite;
/* ----------
* PgStat_MsgBestart Sent by the backend on startup
* ----------