Обсуждение: pgsql: Refactor some code related to transaction-level statistics for r

Поиск
Список
Период
Сортировка

pgsql: Refactor some code related to transaction-level statistics for r

От
Michael Paquier
Дата:
Refactor some code related to transaction-level statistics for relations

This commit refactors find_tabstat_entry() so as transaction counters
for inserted, updated and deleted tuples are included in the result
returned.   If a shared entry is found for a relation, its result is now
a copy of the PgStat_TableStatus entry retrieved from shared memory.
This idea has been proposed by Andres Freund.

While on it, the following SQL functions, used in system views, are
refactored with macros, in the same spirit as 83a1a1b56645, reducing the
amount of code:
- pg_stat_get_xact_tuples_deleted()
- pg_stat_get_xact_tuples_inserted()
- pg_stat_get_xact_tuples_updated()

There is now only one caller of find_tabstat_entry() in the tree.

Author: Bertrand Drouvot
Discussion: https://postgr.es/m/b9e1f543-ee93-8168-d530-d961708ad9d3@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bf01e1ba963aed17449c70fed03c4ae74cce3926

Modified Files
--------------
src/backend/utils/activity/pgstat_relation.c | 40 +++++++++++++++--
src/backend/utils/adt/pgstatfuncs.c          | 66 +++-------------------------
2 files changed, 42 insertions(+), 64 deletions(-)