RE: Cache relation sizes?

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: "Jamison, Kirk" <k(dot)jamison(at)jp(dot)fujitsu(dot)com>, 'Thomas Munro' <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Cache relation sizes?
Date: 2019-02-06 06:29:15
Message-ID: 0A3221C70F24FB45833433255569204D1FB955DF@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: Jamison, Kirk [mailto:k(dot)jamison(at)jp(dot)fujitsu(dot)com]
> On the other hand, the simplest method I thought that could also work is
> to only cache the file size (nblock) in shared memory, not in the backend
> process, since both nblock and relsize_change_counter are uint32 data type
> anyway. If relsize_change_counter can be changed without lock, then nblock
> can be changed without lock, is it right? In that case, nblock can be accessed
> directly in shared memory. In this case, is the relation size necessary
> to be cached in backend?

Although I haven't looked deeply at Thomas's patch yet, there's currently no place to store the size per relation in shared memory. You have to wait for the global metacache that Ideriha-san is addressing. Then, you can store the relation size in the RelationData structure in relcache.

> (2) Is the MdSharedData temporary or permanent in shared memory?
> from the patch:
> typedef struct MdSharedData
> {
> /* XXX could have an array of these, and use rel OID % nelements?
> */
> pg_atomic_uint32 relsize_change_counter;
> } MdSharedData;
>
> static MdSharedData *MdShared;

Permanent in shared memory.

Regards
Takayuki Tsunakawa

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavan Deolasee 2019-02-06 07:32:31 A separate table level option to control compression
Previous Message Kyotaro HORIGUCHI 2019-02-06 06:17:59 Re: Protect syscache from bloating with negative cache entries