On Fri, 31 Jul 2026 at 12:58, Hannu Krosing <[email protected]> wrote: > > I ran a quick test and at least on x64 this is the case indeed: > > hannuk=# create table oid_vs_bigint(id oid primary key, int8 bigint unique); > CREATE TABLE > hannuk=# insert into oid_vs_bigint select i, i 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_pkey │ 2260992 > oid_vs_bigint_int8_key │ 2260992 > (2 rows) > > So, it's not slower because of size, but it's not faster either.
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. Kind regards, Matthias van de Meent.
