Confusing messages about index row size

From: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Confusing messages about index row size
Date: 2021-09-12 05:50:41
Message-ID: 20210912055041.GA4785@ahch-to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi everyone,

I tried an old test that at some point crashed the database... that is
already fixed.

So now it gives a good ERROR message:

"""
postgres=# create table t1 (col1 text, col2 text);
CREATE TABLE
postgres=# create unique index on t1 ((col1 || col2));
CREATE INDEX
postgres=# insert into t1 values((select array_agg(md5(g::text))::text from
postgres(# generate_series(1, 256) g), version());
ERROR: index row requires 8552 bytes, maximum size is 8191
"""

great, so I reduced the length of the index row size:

"""
postgres=# insert into t1 values((select array_agg(md5(g::text))::text from generate_series(1, 200) g), version());
ERROR: index row size 6704 exceeds btree version 4 maximum 2704 for index "t1_expr_idx"
DETAIL: Index row references tuple (0,1) in relation "t1".
HINT: Values larger than 1/3 of a buffer page cannot be indexed.
Consider a function index of an MD5 hash of the value, or use full text indexing.
"""

So, what is it? the index row size could be upto 8191 or cannot be
greater than 2704?

regards,

--
Jaime Casanova
Director de Servicios Profesionales
SystemGuards - Consultores de PostgreSQL

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2021-09-12 06:03:25 Re: Confusing messages about index row size
Previous Message Jaime Casanova 2021-09-12 02:13:38 Re: Schema variables - new implementation for Postgres 15