Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 061bf98

Browse filesBrowse 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
Copy full SHA for 061bf98

File tree

Expand file treeCollapse file tree

1 file changed

+2
-11
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-11
lines changed

‎src/backend/utils/activity/pgstat_relation.c

Copy file name to clipboardExpand all lines: src/backend/utils/activity/pgstat_relation.c
+2-11Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.