Re: Generate pg_stat_get_xact*() functions with Macros

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Generate pg_stat_get_xact*() functions with Macros
Дата
Msg-id 20230105232140.ycxfh5d4lvashek2@awork3.anarazel.de
обсуждение исходный текст
Ответ на Re: Generate pg_stat_get_xact*() functions with Macros  (Corey Huinker <corey.huinker@gmail.com>)
Ответы Re: Generate pg_stat_get_xact*() functions with Macros
Список pgsql-hackers
Hi,

On 2023-01-05 15:19:54 -0500, Corey Huinker wrote:
> It does get me wondering, however, if we reordered the three typedefs to
> group like-typed registers together, we could make them an array with the
> names becoming defined constant index values (or keeping them via a union),
> then the typedefs effectively become:

I think that'd make it substantially enough harder to work with the
datastructures that I don't want to go there.


The "more fundamental" approach would be to switch to using a table-returning
function for accessing these stat values. When just accessing a single counter
or two, the current approach avoids the overhead of having to construct a
tuple. But after that the overhead of having to fetch the stats data (i.e. a
hash table lookup, potentially some locking) multiple times takes over.

Unfortunately there's currently no way to dynamically switch between those
behaviours.

Greetings,

Andres Freund



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