Re: org.postgresql.util.PSQLException: ERROR: index row requires more memory than default(8191)

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: msn <pioneer(dot)suri(at)gmail(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: org.postgresql.util.PSQLException: ERROR: index row requires more memory than default(8191)
Date: 2016-04-20 01:34:04
Message-ID: CAKFQuwY3kRNCJiRWxF4N__zheXgf_kKr3EM-=k7O-2yW73dDTQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, Apr 18, 2016 at 11:05 PM, msn <pioneer(dot)suri(at)gmail(dot)com> wrote:

> I am trying to use PostgreSQL in our existing project to improve the
> performance and make it fiendly with JSON. I have done some research on the
> PostgerSQL and trying to integrate it into our application. But I am facing
> some problem when I tried to insert the large json document into the table.
> It is working with small set of json document but fails with the large
> data.
> The following is the error dispalyed in the console when inserting the
> data.
>
> org.postgresql.util.PSQLException: ERROR: index row requires 11936 bytes,
> maximum size is 8191
> at
>
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2284)
> at
>
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2003)
> at
>
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:200)
> at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:424)
> at
> org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:321)
> at
> org.postgresql.jdbc.PgStatement.executeUpdate(PgStatement.java:297)
> at com.practice.PracticeClass.main(PracticeClass.java:28)
> org.postgresql.util.PSQLException: ERROR: index row requires 11936 bytes,
> maximum size is 8191
>
> In the above error, It is saying memory is not sufficient to create an
> index. I am new to this Postgres. I am not creating any index when
> inserting
> the json document. I am thinking it is internally creating an index for the
> column.
>
> Table creation: Create table sample(id serial, info jsonb);
>
> Could any tell me how to resolve this error or how to configure to increase
> the memory to insert large data.
>
>
​You seem to either be under or mis-reporting your setup here. The
specific error is that an indexed data element cannot be larger than 8191
bytes but the value you are attempting to insert into the index is larger​

​than that. As your example does not include an index there must be
something else involved that does.

​Without a much more detailed, and ideally self-contained, setup it will
not be possible to advise further.

Resolution of the error generally involves not constructing an index on
fields that can become larger than 8191 bytes.

This value is supposedly documented but finding it appears to be
non-trivial...

Its the act of insertion of a too-large document into an indexed column
that provokes the complaint. The index creation has already occurred.

If you know how to use "psql" it would be good to show descriptions of the
relevant objects using its facilities. The same can generally be
accomplished via pgAdmin or whatever tool you use to inspect the database.

David J.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Venkatesan, Sekhar 2016-04-21 09:01:26 PostgreSQL:ALTER TABLE command hangs forever when DB partitioning is enabled.
Previous Message msn 2016-04-19 06:05:13 org.postgresql.util.PSQLException: ERROR: index row requires more memory than default(8191)