pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Gin Index Creation Failure
2+ messages / 2 participants
[nested] [flat]

* Gin Index Creation Failure
@ 2017-08-28 15:42 Yaser Raja <yrraja@gmail.com>
  2017-08-28 16:00 ` Re: Gin Index Creation Failure Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Yaser Raja @ 2017-08-28 15:42 UTC (permalink / raw)
  To: pgsql-bugs

While creating a gin index in Postgres 9.5.8 I got the following error
message:

    ERROR:  invalid memory alloc request size 2013265920

After a number of attempts to independently reproduce this issue, i have
found that this error comes up when the following conditions are met:

   - Table contains more than 200M rows
   - The maintenance_work_mem is around 1GB or higher


Here is a test run which completes successfully:

postgres=# show maintenance_work_mem ;
 maintenance_work_mem
----------------------
 64MB
(1 row)
postgres=#
postgres=# CREATE TABLE gin_test (a int, b jsonb);
CREATE TABLE
postgres=# INSERT INTO gin_test (a) VALUES (generate_series(1,200000000,1));
INSERT 0 200000000
postgres=# CREATE INDEX CONCURRENTLY ON gin_test USING gin(b
jsonb_path_ops);
CREATE INDEX
postgres=#


Here is another test run within the same psql session which fails. The only
difference between the two is that maintenance_work_mem is set to 1GB:

postgres=# drop table gin_test ;
DROP TABLE
postgres=# set maintenance_work_mem = '1GB';
SET
postgres=# show maintenance_work_mem ;
 maintenance_work_mem
----------------------
 1GB
(1 row)
postgres=#
postgres=# CREATE TABLE gin_test (a int, b jsonb);
CREATE TABLE
postgres=# INSERT INTO gin_test (a) VALUES (generate_series(1,200000000,1));
INSERT 0 200000000
postgres=# CREATE INDEX CONCURRENTLY ON gin_test USING gin(b
jsonb_path_ops);
ERROR:  invalid memory alloc request size 2013265920
postgres=#

The index creation fails with the same error with and without
"concurrently". Also the issue comes up without "jsonb_path_ops" as well. I
have tested this on Linux and OSX.

I was not able to reproduce this issue in Postgres 9.6.4.

Regards
Yaser

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Gin Index Creation Failure
  2017-08-28 15:42 Gin Index Creation Failure Yaser Raja <yrraja@gmail.com>
@ 2017-08-28 16:00 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2017-08-28 16:00 UTC (permalink / raw)
  To: Yaser Raja <yrraja@gmail.com>; +Cc: pgsql-bugs

Yaser Raja <yrraja@gmail.com> writes:
> While creating a gin index in Postgres 9.5.8 I got the following error
> message:
>     ERROR:  invalid memory alloc request size 2013265920
> After a number of attempts to independently reproduce this issue, i have
> found that this error comes up when the following conditions are met:
>    - Table contains more than 200M rows
>    - The maintenance_work_mem is around 1GB or higher
> ...
> I was not able to reproduce this issue in Postgres 9.6.4.

Yeah, this appears to have been fixed in commit 30bb26b5e, which was
not back-patched.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2017-08-28 16:00 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-08-28 15:42 Gin Index Creation Failure Yaser Raja <yrraja@gmail.com>
2017-08-28 16:00 ` Tom Lane <tgl@sss.pgh.pa.us>

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