[HACKERS] More efficient truncation of pg_stat_activity query strings

Поиск
Список
Период
Сортировка
От Andres Freund
Тема [HACKERS] More efficient truncation of pg_stat_activity query strings
Дата
Msg-id 20170912071948.pa7igbpkkkviecpz@alap3.anarazel.de
обсуждение исходный текст
Ответы Re: [HACKERS] More efficient truncation of pg_stat_activity querystrings  (Tatsuo Ishii <ishii@sraoss.co.jp>)
Re: [HACKERS] More efficient truncation of pg_stat_activity query strings  (Robert Haas <robertmhaas@gmail.com>)
Re: [HACKERS] More efficient truncation of pg_stat_activity querystrings  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Hi,

I've recently seen a benchmark in which pg_mbcliplen() showed up
prominently. Which it will basically in any benchmark with longer query
strings, but fast queries. That's not that uncommon.

I wonder if we could avoid the cost of pg_mbcliplen() from within
pgstat_report_activity(), by moving some of the cost to the read
side. pgstat values are obviously read far less frequently in nearly all
cases that are performance relevant.

Therefore I wonder if we couldn't just store a querystring that's
essentially just a memcpy()ed prefix, and do a pg_mbcliplen() on the
read side.  I think that should work because all *server side* encodings
store character lengths in the *first* byte of a multibyte character
(at least one clientside encoding, gb18030, doesn't behave that way).

That'd necessitate an added memory copy in pg_stat_get_activity(), but
that seems fairly harmless.

Faults in my thinking?

Greetings,

Andres Freund


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

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Khandekar
Дата:
Сообщение: Re: [HACKERS] UPDATE of partition key
Следующее
От: Ashutosh Bapat
Дата:
Сообщение: Re: [HACKERS] Partition-wise join for join between (declaratively)partitioned tables