git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 309b2cf) | patch
pgstat: Track time of the last scan of a relation
2022年10月14日 18:11:34 +0000 (11:11 -0700)
2022年10月14日 18:11:34 +0000 (11:11 -0700)
commit c037471832e1ec3327f81eebbd8892e5c1042fe0
pgstat: Track time of the last scan of a relation

It can be useful to know when a relation has last been used, e.g., when
evaluating whether an index is still required. It was already possible to
infer the time of the last usage by tracking, e.g.,
pg_stat_all_indexes.idx_scan over time. But far from everybody does so.

To make it easier to detect the last time a relation has been scanned, track
that time in each relation's pgstat entry. To minimize overhead a) the
timestamp is updated only when the backend pending stats entry is flushed to
shared stats b) the last transaction's stop timestamp is used as the
timestamp.

Bumps catalog and stats format versions.

Author: Dave Page <dpage@pgadmin.org>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Bruce Momjian <bruce@momjian.us>
Reviewed-by: Vik Fearing <vik@postgresfriends.org>
Discussion: https://postgr.es/m/CA+OCxozrVHNFVEPkweUHMZje+t1tfY816d9MZYc6eZwOOusOaQ@mail.gmail.com
doc/src/sgml/monitoring.sgml diff | blob | blame | history
src/backend/catalog/system_views.sql diff | blob | blame | history
src/backend/utils/activity/pgstat_relation.c diff | blob | blame | history
src/backend/utils/adt/pgstatfuncs.c diff | blob | blame | history
src/include/catalog/catversion.h diff | blob | blame | history
src/include/catalog/pg_proc.dat diff | blob | blame | history
src/include/pgstat.h diff | blob | blame | history
src/test/regress/expected/rules.out diff | blob | blame | history
src/test/regress/expected/stats.out diff | blob | blame | history
src/test/regress/sql/stats.sql diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /