Re: Redundant syscache access in get_rel_sync_entry()

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: cca5507 <cca5507(at)qq(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Redundant syscache access in get_rel_sync_entry()
Date: 2024-07-11 13:40:58
Message-ID: CAExHW5tC93moA7DN78zkyV4p25ta=P85HwbjC-C2zBcmyJah9Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 11, 2024 at 11:38 AM cca5507 <cca5507(at)qq(dot)com> wrote:

> Hi,
> in func get_rel_sync_entry() we access the same tuple in pg_class three
> times:
> Oid schemaId = get_rel_namespace(relid);
> bool am_partition = get_rel_relispartition(relid);
> char relkind = get_rel_relkind(relid);
> Why not just merge into one?
>

I think it's just convenient. We do that at multiple places; not exactly
these functions but functions which fetch relation attributes from cached
tuples. Given that the tuple is cached and local to the backend, it's not
too expensive. But if there are multiple places which do something like
this, we may want to create more function get_rel_* function which return
multiple properties in one function call. I see get_rel_namspace() and
get_rel_name() called together at many places.

--
Best Wishes,
Ashutosh Bapat

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-07-11 13:50:00 Re: CFbot failed on Windows platform
Previous Message Euler Taveira 2024-07-11 13:34:04 Re: speed up a logical replica setup