Re: [COMMITTERS] pgsql: Speedup pgstat_report_activity by moving mb-aware truncation to

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [COMMITTERS] pgsql: Speedup pgstat_report_activity by moving mb-aware truncation to
Дата
Msg-id 1506.1505854389@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [COMMITTERS] pgsql: Speedup pgstat_report_activity by movingmb-aware truncation to  (Andres Freund <andres@anarazel.de>)
Ответы Re: [COMMITTERS] pgsql: Speedup pgstat_report_activity by movingmb-aware truncation to
Список pgsql-committers
Andres Freund <andres@anarazel.de> writes:
> On 2017-09-19 16:25:31 -0400, Tom Lane wrote:
>> Looks like you're going to need to not depend on strnlen().

> Yup noticed - we have pg_strnlen as a static function in
> src/port/snprintf. I'm tempted to just make that public, rather than
> open code the equivalent?

No, we should not tie this to whether we're using port/snprintf.c.

Personally, I don't see why this isn't coded more like
int rawlen = strlen(activity);
rawlen = Min(rawlen, pgstat_track_activity_query_size - 1);

It seems likely to me that strlen() is going to be optimized a lot
harder than strnlen() on most platforms, so that this way would win
not only for strings up to pgstat_track_activity_query_size but for
strings some way beyond that.  Yes, for really really long queries
the strnlen way would win, but that's optimizing for the wrong case IMO.

If you really insist on strnlen() then we're going to have to move
it to its own src/port/ file with a configure test.
        regards, tom lane


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

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Make new crash restart test a bit more robust.
Следующее
От: Andres Freund
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Make new crash restart test a bit morerobust.