Re: [UPDATED] A GUC variable to replace PGBE_ACTIVITY_SIZE - Mailing list pgsql-patches

From Heikki Linnakangas
Subject Re: [UPDATED] A GUC variable to replace PGBE_ACTIVITY_SIZE
Date
Msg-id 4868BC90.2080209@enterprisedb.com
Whole thread Raw
In response to Re: [UPDATED] A GUC variable to replace PGBE_ACTIVITY_SIZE  (Thomas Lee <tom@vector-seven.com>)
Responses Re: [UPDATED] A GUC variable to replace PGBE_ACTIVITY_SIZE
List pgsql-patches
Thomas Lee wrote:
> An updated patch for the track_activity_query_size GUC variable.

Thanks, committed with some changes.

There was one bug: BackendStatusShmemSize() needs to report the memory
needed for the activity string buffers; it's used for sizing the single
fixed size shmem block on postmaster startup. I also fixed the
documentation to refer to the setting with the right name, noted that
it's a startup time option, and changed the wording a bit.

I tested the performance between strcpy and memcpy a little bit. As
expected, strcpy is a lot cheaper if the string is small. I chose
strcpy, since it's very likely that the buffer is over-sized, and even
if it's just the right size to hold typical queries, it's going to be
"<IDLE>" for idle connections.

Another simple optimization occurred to me while looking at this: we
should skip the memcpy/strcpy altogether if the BackendActivity slot is
not in use. That seems like a good bet, you usually don't try to max out
max_connections.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

pgsql-patches by date:

Previous
From: Tom Raney
Date:
Subject: Re: Explain XML patch
Next
From: Tom Lane
Date:
Subject: Re: [UPDATED] A GUC variable to replace PGBE_ACTIVITY_SIZE