| From: | Hannu Krosing <hannuk(at)google(dot)com> |
|---|---|
| To: | Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com> |
| Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Support for 8-byte TOAST values, round two |
| Date: | 2026-07-31 14:16:35 |
| Message-ID: | CAMT0RQReBcQUnbBUiGvw1xTJQGBk19L_+0F5vKZpsGRYkuPVxA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, Jul 31, 2026 at 1:10 PM Matthias van de Meent
<boekewurm+postgres(at)gmail(dot)com> wrote:
>
...
> This test is not representative of real toast indexes, because it
> skips the chunk number column. The addition of the chunk number column
> will impact the size of the index, because now the index items are 16B
> for OID vs 24B for OID8, for 20B and 28B page data usage respectively
> after taking the 4-byte line pointer into account. Back of the
> envelope calculations indicate this means the OID8 index will be about
> 40% larger.
Yes, you are right:
hannuk=# create table oid_vs_bigint(id oid, int8 bigint, chunk_id int,
unique(id, chunk_id), unique(int8, chunk_id));
CREATE TABLE
hannuk=# insert into oid_vs_bigint select i, i, 0 from
generate_series(1,100000) g(i);
INSERT 0 100000
hannuk=# select indexrelid::regclass, pg_relation_size(indexrelid)
from pg_index where indrelid = 'oid_vs_bigint'::regclass;
indexrelid │ pg_relation_size
─────────────────────────────────┼──────────────────
oid_vs_bigint_id_chunk_id_key │ 2260992
oid_vs_bigint_int8_chunk_id_key │ 3162112
(2 rows)
So indeed 40% more, and you get the *same* number even if you used
OID6 (i.e 6-byte tid)
hannuk=# create table oid_vs_bigint(id oid, int8 tid, chunk_id int,
unique(id, chunk_id), unique(int8, chunk_id));
CREATE TABLE
hannuk=# insert into oid_vs_bigint select i, format('(%s,1)',i)::tid,
0 from generate_series(1,100000) g(i);
INSERT 0 100000
hannuk=# select * from oid_vs_bigint limit 2;
id │ int8 │ chunk_id
────┼───────┼──────────
1 │ (1,1) │ 0
2 │ (2,1) │ 0
(2 rows)
hannuk=# select indexrelid::regclass, pg_relation_size(indexrelid)
from pg_index where indrelid = 'oid_vs_bigint'::regclass;
indexrelid │ pg_relation_size
─────────────────────────────────┼──────────────────
oid_vs_bigint_id_chunk_id_key │ 2260992
oid_vs_bigint_int8_chunk_id_key │ 3162112
(2 rows)
----
Hannu
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tomas Vondra | 2026-07-31 14:33:19 | Re: hashjoins vs. Bloom filters (yet again) |
| Previous Message | Bertrand Drouvot | 2026-07-31 14:16:25 | Re: pgstat: Flush some statistics within running transactions, take 2 |