Re: Reducing relcache memory usage 2: shrink sizeof(RelationData)

From: "Yilin Zhang" <jiezhilove(at)126(dot)com>
To: "David Geier" <geidav(dot)pg(at)gmail(dot)com>
Cc: "Matthias van de Meent" <boekewurm+postgres(at)gmail(dot)com>, "Haibo Yan" <tristan(dot)yim(at)gmail(dot)com>, "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reducing relcache memory usage 2: shrink sizeof(RelationData)
Date: 2026-10-20 06:56:52
Message-ID: 632af30c.4d4c.1a1581940a9.Coremail.jiezhilove@126.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 2026-10-19 21:31:32, "David Geier" <geidav(dot)pg(at)gmail(dot)com> wrote:
>Hi Matthias!
>
>Thanks for taking another look.
>
...
>>
>> This should probably check that len == sizeof(RelationData), and then
>> just use the AllocRelationData() macro used everywhere else.
>
>Changed to use AllocRelationData(). A few lines above there's already
>
>if (len != sizeof(RelationData))
> goto read_failed;
>
>Hence, no need for an assertion.
>
>> 0003: I agree with Alvaro's comment; if moving ForeignKeyCacheInfo to
>> its own header would also solve the issue then that's preferred.
>
>I'm waiting for Alvaro's and Peter's reply before changing that part.
>
>Any thoughts from your side regarding moving ForeignKeyCacheInfo into
>its own header vs building support for anonymous structs/unions in
>gen_node_support.pl?
...
>* The lmgr.h include is unnecessary. Removed.
>* The miscadmin.h include is necessary for MyDatabaseId.
>
>
>I've also created a commitfest entry, see [1].
>
>--
>David Geier

Hi,
Thanks for your patches.
There is still a crash in the v5 patch series, similar to the predicate crash that Haibo already mentioned.
Minimal reproduction steps:

CREATE TABLE t(a int primary key, b text);
CREATE INDEX t_b_idx ON t(b);

SELECT pg_relation_is_updatable('t_b_idx'::regclass, false);
-- server closed the connection unexpectedly

SELECT pg_column_is_updatable('t_b_idx'::regclass, 1::int2, false);
-- server closed the connection unexpectedly

Please take this into consideration.

Best regards,
Yilin Zhang

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-10-20 07:01:29 Re: tablecmds: Deadlock caused by Attach Partition
Previous Message Hayato Kuroda (Fujitsu) 2026-10-20 06:21:42 RE: [PG19] Sequence sync stops when the subscription owner can't SET ROLE to a sequence owner