From: Tom Lane <tgl@sss.pgh.pa.us>
To: Manuel Rigger <rigger.manuel@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BETWEEN SYMMETRIC condition results in "row is too big: ..., maximum size 8160"
Date: Tue, 16 Jul 2019 19:52:19 -0400
Message-ID: <23315.1563321139@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+u7OA6zYX7qfkGGDfqeFwuh6HbD4B-0fmOfx13Jm4xsp3s=-Q@mail.gmail.com>
References: <CA+u7OA6zYX7qfkGGDfqeFwuh6HbD4B-0fmOfx13Jm4xsp3s=-Q@mail.gmail.com>
Manuel Rigger <rigger.manuel@gmail.com> writes:
> I noticed that indexes that use nested BETWEEN SYMMETRIC operators
> quickly exceed some limit, which is indicated by errors such as
> "ERROR: row is too big: size 8440, maximum size 8160". For example,
> consider the following (contrived) index:
> CREATE TABLE t0(c0 TEXT);
> CREATE INDEX i0 ON t0(c0) WHERE ((FALSE BETWEEN SYMMETRIC TRUE AND
> (t0.c0 || t0.c0 IN (t0.c0, t0.c0, '1', t0.c0 || t0.c0, t0.c0 || t0.c0
> || t0.c0))) BETWEEN SYMMETRIC TRUE AND TRUE) BETWEEN SYMMETRIC TRUE
> AND TRUE; -- ERROR: row is too big: size 8440, maximum size 8160
It's not specifically BETWEEN SYMMETRIC that's at issue --- any
sufficiently complex index WHERE condition or index expression will
do it. (BETWEEN SYMMETRIC helps things along because it duplicates
its subexpressions, though.)
> Is this an expected limitation?
Yeah. Those expressions are stored in pg_index, which doesn't have
a TOAST table so there's a hard limit on its row width. Adding a
TOAST table would create some interesting circularity issues, and
there doesn't seem to be that much real-world use for very complex
index expressions or predicates, so we haven't tried to fix it.
(If you're desperate for some way to overcome the limit, though,
you can do so by creating a SQL function and using it in the
index expression.)
If you're interested, there was some discussion not too long ago
about which system catalogs should have TOAST tables:
https://www.postgresql.org/message-id/flat/84ddff04-f122-784b-b6c5-3536804495f8%40joeconway.com
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, rigger.manuel@gmail.com
Subject: Re: BETWEEN SYMMETRIC condition results in "row is too big: ..., maximum size 8160"
In-Reply-To: <23315.1563321139@sss.pgh.pa.us>
References: <CA+u7OA6zYX7qfkGGDfqeFwuh6HbD4B-0fmOfx13Jm4xsp3s=-Q@mail.gmail.com> <23315.1563321139@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox