Re: BUG #16986: reindex error on ltree index

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: mauro(at)enuan(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16986: reindex error on ltree index
Date: 2021-05-02 16:26:29
Message-ID: CAPpHfdug2N+BsmQyPuuBhPyHQYe6NLX=Ta8KTdhnxVj=2KJxNA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

.Hi, Mauro!

On Thu, Apr 29, 2021 at 1:33 PM PG Bug reporting form
<noreply(at)postgresql(dot)org> wrote:
> reindexing a table with ltree index this error is thrown:
> ERROR: index row size 7720 exceeds maximum 8152 for index
> "ltree_test_session_event_path_idx"
> Follow script to reproduce error:
> ---------------------------------------------------------------
> CREATE TABLE "m3_dm"."ltree_test" (
> "session_id" varchar COLLATE "pg_catalog"."default" NOT NULL,
> "session_event_path" "public"."ltree",
> CONSTRAINT "ltree_test_pkey" PRIMARY KEY ("session_id")
> );
> CREATE INDEX "ltree_test_session_event_path_idx" ON "m3_dm"."ltree_test"
> USING gist (
> "session_event_path" "public"."gist_ltree_ops"
> );
> insert into m3_dm.ltree_test
> values (
> 'aaa',
> text2ltree(repeat('abcdefghi.',480)||'abcdefghi')
> )
> ;
> reindex table m3_dm.ltree_test;

Thank you for reporting. Generally, GiST isn't good at controlling
maximum tuple length. If your tuple is long error can be raised
randomly here and there.

Your particular case is related to GiST fillfactor. Normal insertion
doesn't take fillfactor into account but index build does. You can
resolve this case by specifying fillfactor = 100.

CREATE INDEX "ltree_test_session_event_path_idx" ON "m3_dm"."ltree_test"
USING gist (
"session_event_path" "public"."gist_ltree_ops"
) WITH (fillfactor = 100);

Besides fact that GiST need a general rework at controlling maximum
tuple length, the error message looks really dumb. 7720 doesn't
exceed 8152. I'm going to fix this.

------
Regards,
Alexander Korotkov

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Korotkov 2021-05-02 17:45:18 Re: websearch_to_tsquery() returns queries that don't match to_tsvector()
Previous Message PG Bug reporting form 2021-05-02 08:42:51 BUG #16990: Random PANIC in qemu user context