Avoid double lookup in pgstat_fetch_stat_tabentry()

Bertrand Drouvot <bertranddrouvot.pg@gmail.com>

From: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-11-18T05:01:12Z
Lists: pgsql-hackers

Attachments

Hi hackers,

Please find attached a patch proposal to avoid 2 calls to 
pgstat_fetch_stat_tabentry_ext() in pgstat_fetch_stat_tabentry() in case 
the relation is not a shared one and no statistics are found.

Thanks Andres for the suggestion done in [1].

[1]: 
https://www.postgresql.org/message-id/20221116201202.3k74ajawyom2c3eq%40awork3.anarazel.de

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Commits

  1. pgstat: replace double lookup with IsSharedRelation()