Re: Reducing relcache memory usage: deduping index shapes

From: David Geier <geidav(dot)pg(at)gmail(dot)com>
To: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Reducing relcache memory usage: deduping index shapes
Date: 2026-09-10 14:00:15
Message-ID: 71b1e364-7b06-4b5e-be2f-047471a02589@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>> Back-of-the-envelope calculation: Currently, RelationData is 488
>>> bytes, of which 50 wasted on alignment (so, 48 bytes recoverable). If
>>> we somehow get the index and table fields to not be used at the same
>>> time, we'd gain another 128 bytes (because the larger of the two must
>>> remain). This leaves us with 312 bytes, which is still 56 bytes over
>>> the target, and I don't think we can trivially find 7 pointers' worth
>>> of fields to remove.
>>>
>>> But, feel free to try.
>>
>> I've managed to crunch sizeof(RelationData) down to 256 bytes and
>> there's some more room for improvement, see below. Attached is the patch
>> set. It passes tests.
>
> That's cool. I'm not fully on board with all the techniques you
> applied, but it does seem like some of these can be useful. If you're
> up to getting this from POC to a workable state, please start a
> separate thread with its own CF entry, then we can discuss over there.
I've opened a new thread for reducing the size of RelationData.
See [1].

--
David Geier

[1]
https://www.postgresql.org/message-id/flat/f97de758-b816-47db-96e0-0e6e2c2d3eef%40gmail.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Henson Choi 2026-09-10 14:05:43 Re: Row pattern recognition
Previous Message Jeevan Chalke 2026-09-10 13:55:56 Re: Add PRODUCT() aggregate function