Skip to content

Commit 061bf98

Browse files
committed
pgstat: replace double lookup with IsSharedRelation()
As the list of shared relations is fixed, we can just dispatch based IsSharedRelation(), instead of first trying to look up stats for a non-shared rel and falling back to shared stats. Author: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com> Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> Reviewed-by: Andres Freund <andres@anarazel.de Discussion: https://postgr.es/m/8c1851a2-a98e-e1bc-7729-37b0b95f66ec@gmail.com
1 parent b623037 commit 061bf98

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/backend/utils/activity/pgstat_relation.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "utils/pgstat_internal.h"
2626
#include "utils/rel.h"
2727
#include "utils/timestamp.h"
28+
#include "catalog/catalog.h"
2829

2930

3031
/* Record that's written to 2PC state file when pgstat state is persisted */
@@ -437,17 +438,7 @@ pgstat_update_heap_dead_tuples(Relation rel, int delta)
437438
PgStat_StatTabEntry *
438439
pgstat_fetch_stat_tabentry(Oid relid)
439440
{
440-
PgStat_StatTabEntry *tabentry;
441-
442-
tabentry = pgstat_fetch_stat_tabentry_ext(false, relid);
443-
if (tabentry != NULL)
444-
return tabentry;
445-
446-
/*
447-
* If we didn't find it, maybe it's a shared table.
448-
*/
449-
tabentry = pgstat_fetch_stat_tabentry_ext(true, relid);
450-
return tabentry;
441+
return pgstat_fetch_stat_tabentry_ext(IsSharedRelation(relid), relid);
451442
}
452443

453444
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy