From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@postgresql.org
Subject: pgsql: Speedup pgstat_report_activity by moving mb-aware truncation to
Date: Tue, 19 Sep 2017 20:03:51 +0000
Message-ID: <E1duOkJ-0001Mc-U5@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Speedup pgstat_report_activity by moving mb-aware truncation to read side.
Previously multi-byte aware truncation was done on every
pgstat_report_activity() call - proving to be a bottleneck for
workloads with long query strings that execute quickly.
Instead move the truncation to the read side, which commonly is
executed far less frequently. That's possible because all server
encodings allow to determine the length of a multi-byte string from
the first byte.
Rename PgBackendStatus.st_activity to st_activity_raw so existing
extension users of the field break - their code has to be adjusted to
use pgstat_clip_activity().
Author: Andres Freund
Tested-By: Khuntal Ghosh
Reviewed-By: Robert Haas, Tom Lane
Discussion: https://postgr.es/m/20170912071948.pa7igbpkkkviecpz@alap3.anarazel.de
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/54b6cd589ac2f5635a42511236a5eb7299e2dcaf
Modified Files
--------------
src/backend/postmaster/pgstat.c | 63 ++++++++++++++++++++++++++++---------
src/backend/utils/adt/pgstatfuncs.c | 17 +++++++---
src/include/pgstat.h | 12 +++++--
3 files changed, 72 insertions(+), 20 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de
Subject: Re: pgsql: Speedup pgstat_report_activity by moving mb-aware truncation to
In-Reply-To: <E1duOkJ-0001Mc-U5@gemulon.postgresql.org>
References: <E1duOkJ-0001Mc-U5@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox