org.postgresql.util.PSQLException: ERROR: index row requires more memory than default(8191) -
i trying use postgresql in our existing project improve performance , make fiendly json. have done research on postgersql , trying integrate our application. facing problem when tried insert large json document table. working small set of json document fails large data. following error dispalyed in console when inserting data.
org.postgresql.util.psqlexception: error: index row requires 11936 bytes, maximum size 8191 @ org.postgresql.core.v3.queryexecutorimpl.receiveerrorresponse(queryexecutorimpl.java:2284) @ org.postgresql.core.v3.queryexecutorimpl.processresults(queryexecutorimpl.java:2003) @ org.postgresql.core.v3.queryexecutorimpl.execute(queryexecutorimpl.java:200) @ org.postgresql.jdbc.pgstatement.execute(pgstatement.java:424) @ org.postgresql.jdbc.pgstatement.executewithflags(pgstatement.java:321) @ org.postgresql.jdbc.pgstatement.executeupdate(pgstatement.java:297) @ com.practice.practiceclass.main(practiceclass.java:28) org.postgresql.util.psqlexception: error: index row requires 11936 bytes, maximum size 8191
practiceclass.java
package com.practice; import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; public class practiceclass { public static void main(string[] args) throws sqlexception { connection c = null; statement st = null; try { class.forname("org.postgresql.driver"); c = drivermanager .getconnection("jdbc:postgresql://localhost:5432/jsonbdb", "postgres", "admin"); system.out.println("opened database successfully"); st = c.createstatement(); string query = "create table ipaudeviceinfo(id serial, deviceinfo jsonb unique)"; st.executeupdate(query); system.out.println("table created successfully"); stringbuilder strbuilder = new stringbuilder(); strbuilder.append(**large_json_document**); string insertquery = "insert ipaudeviceinfo(\"deviceinfo\") values(" + strbuilder.tostring() + ")"; st.executeupdate(insertquery); system.out.println("inserted successfully"); /*string upadtequery = "update jsonbtab_unique set \"deviceinfo\" = jsonb_set(\"deviceinfo\", '{deviceid}', '\"sharp-mx-dev_10002\"', true) \"deviceinfo\"-> 'deviceid' = '\"brother_dev_001\"'"; st.executeupdate(upadtequery);*/ resultset rs = st.executequery("select (\"deviceinfo\") ipaudeviceinfo"); while(rs.next()) { system.out.println("count: " + rs.getfetchsize()); system.out.println("rows: " + rs.getstring("deviceinfo")); } } catch (exception e) { e.printstacktrace(); system.err.println(e.getclass().getname()+": "+e.getmessage()); system.exit(0); } { c.close(); st.close(); } } }
in above error, saying memory not sufficient create index. new postgres. not creating index when inserting json document. thinking internally creating index column.
table creation:
create table sample(id serial, info jsonb);
could tell me how resolve error or how configure increase memory insert large data.
Comments
Post a Comment