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

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Reply via email to