Re: Increasing the length of pg_stat_activity.current_query...

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Greg Stark <gsstark(at)MIT(dot)EDU>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Stark <gsstark(at)mit(dot)edu>, Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Increasing the length of pg_stat_activity.current_query...
Date: 2004-11-08 22:30:42
Message-ID: 873bzkj7n1.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Stark <gsstark(at)MIT(dot)EDU> writes:

> The only problem I see in raising the size of PGSTAT_MSG_PAYLOAD is that it
> also governs the size of PGSTAT_NUM_TABPURGE and PGSTAT_NUM_TABENTRIES.
> There's no need to grow those arrays and risk losing them. But these message
> sizes could just be left based on the 1k value while boosting the maximum size
> of PGSTAT_ACTIVITY_SIZE.

Just to be clear, I'm talking about something as simple as this:
(Haven't finished compiling it yet)

--- pgstat.h.~1.26.~ 2004-08-29 00:13:03.000000000 -0400
+++ pgstat.h 2004-11-08 17:17:17.000000000 -0500
@@ -57,12 +57,13 @@
} PgStat_MsgHdr;

/* ----------
- * Space available in a message. This will keep the UDP packets below 1K,
- * which should fit unfragmented into the MTU of the lo interface on most
- * platforms. Does anybody care for platforms where it doesn't?
+ * Space used by a message ideally and maximum space used. We try to not to go
+ * over 1k unless necessary to avoid UDP packets that don't fit into the MTU
+ * of the loopback interface on very old systems and need to be fragmented.
* ----------
*/
-#define PGSTAT_MSG_PAYLOAD (1000 - sizeof(PgStat_MsgHdr))
+#define PGSTAT_MSG_PAYLOAD_IDEAL (1000 - sizeof(PgStat_MsgHdr))
+#define PGSTAT_MSG_PAYLOAD (32740 - sizeof(PgStat_MsgHdr))

/* ----------
* PgStat_TableEntry Per-table info in a MsgTabstat
@@ -131,7 +132,7 @@
* and buffer access statistics.
* ----------
*/
-#define PGSTAT_NUM_TABENTRIES ((PGSTAT_MSG_PAYLOAD - 3 * sizeof(int)) \
+#define PGSTAT_NUM_TABENTRIES ((PGSTAT_MSG_PAYLOAD_IDEAL - 3 * sizeof(int)) \
/ sizeof(PgStat_TableEntry))

typedef struct PgStat_MsgTabstat
@@ -148,7 +149,7 @@
* about dead tables.
* ----------
*/
-#define PGSTAT_NUM_TABPURGE ((PGSTAT_MSG_PAYLOAD - sizeof(int)) \
+#define PGSTAT_NUM_TABPURGE ((PGSTAT_MSG_PAYLOAD_IDEAL - sizeof(int)) \
/ sizeof(Oid))

typedef struct PgStat_MsgTabpurge

--
greg

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-11-08 22:32:09 Re: Increasing the length of pg_stat_activity.current_query...
Previous Message Greg Stark 2004-11-08 22:02:58 Re: Increasing the length of pg_stat_activity.current_query...