Confusing messages about index row size - Mailing list pgsql-hackers

From Jaime Casanova
Subject Confusing messages about index row size
Date
Msg-id 20210912055041.GA4785@ahch-to
Whole thread Raw
Responses Re: Confusing messages about index row size
List 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



pgsql-hackers by date:

Previous
From: Jaime Casanova
Date:
Subject: Re: Schema variables - new implementation for Postgres 15
Next
From: "David G. Johnston"
Date:
Subject: Re: Confusing messages about index row size