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