1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-22 12:22:45 +03:00

pgstat: introduce pgstat_relation_should_count().

A later commit will make the check more complicated than the
current (rel)->pgstat_info != NULL. It also just seems nicer to have a central
copy of the logic, even while still simple.

Author: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de
This commit is contained in:
Andres Freund
2022-03-20 19:12:09 -07:00
parent 2d655a08d5
commit 8363102009
3 changed files with 28 additions and 27 deletions

View File

@@ -1743,7 +1743,7 @@ index_concurrently_swap(Oid newIndexId, Oid oldIndexId, const char *oldName)
tabentry = pgstat_fetch_stat_tabentry(oldIndexId);
if (tabentry)
{
if (newClassRel->pgstat_info)
if (pgstat_relation_should_count(newClassRel))
{
newClassRel->pgstat_info->t_counts.t_numscans = tabentry->numscans;
newClassRel->pgstat_info->t_counts.t_tuples_returned = tabentry->tuples_returned;