Re: Avoid double lookup in pgstat_fetch_stat_tabentry()

2022-11-20 Thread Andres Freund
Hi, On 2022-11-19 09:38:26 +0100, Drouvot, Bertrand wrote: > I'd vote for V3 for readability, size and "backward compatibility" with > current code. Pushed that. Thanks for the patch and evaluation. Greetings, Andres Freund

Re: Avoid double lookup in pgstat_fetch_stat_tabentry()

2022-11-19 Thread Drouvot, Bertrand
Hi, On 11/18/22 6:32 PM, Andres Freund wrote: Hi, On 2022-11-18 11:09:43 +0100, Drouvot, Bertrand wrote: Furthermore, the pgstat_fetch_stat_tabentry() can just be a static inline function. I think that's just premature optimization for something like this. The function call overhead on

Re: Avoid double lookup in pgstat_fetch_stat_tabentry()

2022-11-18 Thread Andres Freund
Hi, On 2022-11-18 11:09:43 +0100, Drouvot, Bertrand wrote: > > Furthermore, the pgstat_fetch_stat_tabentry() can just be a > > static inline function. I think that's just premature optimization for something like this. The function call overhead on accessing stats can't be a relevant factor -

Re: Avoid double lookup in pgstat_fetch_stat_tabentry()

2022-11-18 Thread Bharath Rupireddy
On Fri, Nov 18, 2022 at 3:41 PM Drouvot, Bertrand wrote: > > > However, I have a suggestion to simplify it > > further by getting rid of the local variable tabentry and just > > returning pgstat_fetch_stat_tabentry_ext(IsSharedRelation(relid), > > relid);. Furthermore, the

Re: Avoid double lookup in pgstat_fetch_stat_tabentry()

2022-11-18 Thread Drouvot, Bertrand
Hi, On 11/18/22 7:06 AM, Bharath Rupireddy wrote: On Fri, Nov 18, 2022 at 10:32 AM Drouvot, Bertrand wrote: 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

Re: Avoid double lookup in pgstat_fetch_stat_tabentry()

2022-11-17 Thread Bharath Rupireddy
On Fri, Nov 18, 2022 at 10:32 AM Drouvot, Bertrand wrote: > > 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

Avoid double lookup in pgstat_fetch_stat_tabentry()

2022-11-17 Thread Drouvot, Bertrand
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]: