Re: 回复:Re: Cache relation sizes?

From: Anastasia Lubennikova <lubennikovaav(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: David Steele <david(at)pgmasters(dot)net>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, 陈佳昕(步真) <buzhen(dot)cjx(at)alibaba-inc(dot)com>
Subject: Re: 回复:Re: Cache relation sizes?
Date: 2021-07-14 12:38:37
Message-ID: CAP4vRV7jy3s62Md4ThxwvuuJty8jtBpz7ruEmSs5sUt=H+O32w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 16, 2021 at 9:24 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:

> No change yet, just posting a rebase to keep cfbot happy.
>
>
Hi, Thomas

I think that the proposed feature is pretty cool not only because it fixes
some old issues with lseek() performance and reliability, but also because
it opens the door to some new features, such as disk size quota management
[1]. Cheap up-to-date size tracking is one of the major problems for it.

I've only read the 1st patch so far. Here are some thoughts about it:

- SMgrSharedRelation - what about calling it SMgrShmemRelation. It looks
weird too, but "...SharedRelation" makes me think of shared catalog tables.

- We can exclude temp relations from consideration as they are never
shared and use RelFileNode instead of RelFileNodeBackend in
SMgrSharedRelationMapping.
Not only it will save us some space, but also it will help to avoid a
situation when temp relations occupy whole cache (which may easily happen
in some workloads).
I assume you were trying to make a generic solution, but in practice, temp
rels differ from regular ones and may require different optimizations.
Local caching will be enough for them if ever needed, for example, we can
leave smgr_cached_nblocks[] for temp relations.

> int smgr_shared_relations = 1000;
- How bad would it be to keep cache for all relations? Let's test memory
overhead on some realistic datasets. I suppose this 1000 default was chosen
just for WIP patch.
I wonder if we can use DSM instead of regular shared memory?

- I'd expect that CREATE DATABASE and ALTER DATABASE SET TABLESPACE require
special treatment, because they bypass smgr, just like dropdb. Don't see it
in the patch.

[1] https://github.com/greenplum-db/diskquota

--
Best regards,
Lubennikova Anastasia

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-07-14 12:50:16 Re: row filtering for logical replication
Previous Message Ajin Cherian 2021-07-14 12:30:17 Re: logical replication empty transactions