pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedcreating gist index on ltree column failed
3+ messages / 2 participants
[nested] [flat]
* creating gist index on ltree column failed
@ 2020-09-23 13:31 jian xu <jamesxu@outlook.com>
2020-09-23 14:37 ` Re: creating gist index on ltree column failed Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: jian xu @ 2020-09-23 13:31 UTC (permalink / raw)
To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Hello,
I tried to create gist index on a ltree column, first I got error
=====
ERROR: stack depth limit exceeded
HINT: Increase the configuration parameter "max_stack_depth" (currently 32768kB), after ensuring the platform's stack depth limit is adequate.
=====
I increased system memory size with "ulimit -S -s 131072", then run "set max_stack_depth = '64MB';"
this time I got some other errors:
"failed to add item to index page" or "no unpinned buffers available"
sometimes if I rerun it, or run vacuum on the table first, the creating index runs for ever until all the system memory was eaten up, then server was hang, I had to reboot the server.
one thing I notice is, there are some rows with many levels(more than 1k levels) in the ltree, if I delete those rows, creating gist index works
is it a bug in the gist index? does anyone know how to workaround this problem?
thank you
James
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: creating gist index on ltree column failed
2020-09-23 13:31 creating gist index on ltree column failed jian xu <jamesxu@outlook.com>
@ 2020-09-23 14:37 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-09-23 16:29 ` Re: creating gist index on ltree column failed jian xu <jamesxu@outlook.com>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2020-09-23 14:37 UTC (permalink / raw)
To: jian xu <jamesxu@outlook.com>; +Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
jian xu <jamesxu@outlook.com> writes:
> I tried to create gist index on a ltree column, first I got error
> ERROR: stack depth limit exceeded
Hm. What PG version is this? If it's up-to-date, can you provide some
sample data that causes such problems?
> one thing I notice is, there are some rows with many levels(more than 1k levels) in the ltree, if I delete those rows, creating gist index works
I tried to reproduce this using just that information, but all I got was
regression=# create table t (f1 ltree);
CREATE TABLE
regression=# create index on t using gist(f1);
CREATE INDEX
regression=# insert into t select ('0.' || (select string_agg(g::text,'.') from generate_series(1,100) g))::ltree;
INSERT 0 1
regression=# insert into t select ('0.' || (select string_agg(g::text,'.') from generate_series(1,1000) g))::ltree;
ERROR: index row requires 16048 bytes, maximum size is 8191
which is perhaps an annoying limitation, but it's not a bug.
(I'm kind of wondering about the use-case for such long ltrees, anyway.)
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: creating gist index on ltree column failed
2020-09-23 13:31 creating gist index on ltree column failed jian xu <jamesxu@outlook.com>
2020-09-23 14:37 ` Re: creating gist index on ltree column failed Tom Lane <tgl@sss.pgh.pa.us>
@ 2020-09-23 16:29 ` jian xu <jamesxu@outlook.com>
0 siblings, 0 replies; 3+ messages in thread
From: jian xu @ 2020-09-23 16:29 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Thanks Tom for your reply. my pg version is 11.8.
I used "select into" to export some long rows to a new table, then tried to create gist index on it. I got same error as yours.
===
CREATE INDEX order_tree_path_idx_mytbl
ON mytbl USING gist
(path);
ERROR: index row size 7496 exceeds maximum 8152 for index "order_tree_path_idx_mytbl"
===
so it looks like the errors I got might be related with other data in the same table, but I am not sure which rows, there are 12k rows in the table.
regarding as the gist index size limitation 8152 , do you know how to workaround it? if we set the block size from 8k to a large value(32k), will it help?
thank you
James
________________________________
From: Tom Lane <tgl@sss.pgh.pa.us>
Sent: Wednesday, September 23, 2020 10:37
To: jian xu <jamesxu@outlook.com>
Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: creating gist index on ltree column failed
jian xu <jamesxu@outlook.com> writes:
> I tried to create gist index on a ltree column, first I got error
> ERROR: stack depth limit exceeded
Hm. What PG version is this? If it's up-to-date, can you provide some
sample data that causes such problems?
> one thing I notice is, there are some rows with many levels(more than 1k levels) in the ltree, if I delete those rows, creating gist index works
I tried to reproduce this using just that information, but all I got was
regression=# create table t (f1 ltree);
CREATE TABLE
regression=# create index on t using gist(f1);
CREATE INDEX
regression=# insert into t select ('0.' || (select string_agg(g::text,'.') from generate_series(1,100) g))::ltree;
INSERT 0 1
regression=# insert into t select ('0.' || (select string_agg(g::text,'.') from generate_series(1,1000) g))::ltree;
ERROR: index row requires 16048 bytes, maximum size is 8191
which is perhaps an annoying limitation, but it's not a bug.
(I'm kind of wondering about the use-case for such long ltrees, anyway.)
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2020-09-23 16:29 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-09-23 13:31 creating gist index on ltree column failed jian xu <jamesxu@outlook.com>
2020-09-23 14:37 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-09-23 16:29 ` jian xu <jamesxu@outlook.com>
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