I'm using H2 1.2.131 with the following schema
c.createStatement().execute("CREATE TABLE NOTES ("
+ "ID IDENTITY, "
+ "ISACTIVE BIT NOT NULL, "
+ "GUID CHAR(36) NOT NULL,"
+ "SERIALIZEDOBJECT OTHER, "
+ "CONTENT VARCHAR(5242880) NOT NULL,"
// + "PRIMARY KEY (ID),
"
+ "CONSTRAINT UNQ_GUID UNIQUE (GUID))");
c.createStatement().execute("CREATE TABLE RESOURCES ("
+ "GUID CHAR(36) NOT NULL,"
+ "SERIALIZEDOBJECT OTHER, "
+ "OWNERGUID CHAR(36), "
+ "HASH CHAR(32), "
+ "DATA BINARY, "
+ "CONSTRAINT UNQ_GUID_RES UNIQUE (GUID))");
c.createStatement().execute("CREATE INDEX
I_RSOURCS_OWNER ON RESOURCES (OWNERGUID)");
I get an OutOfMemoryError while inserting rows.
org.h2.jdbc.JdbcSQLException: Out of memory.; SQL statement:
INSERT INTO RESOURCES VALUES(?,?,?,?,?) [90108-131]
at
org.h2.message.DbException.getJdbcSQLException(DbException.java:316)
at org.h2.message.DbException.get(DbException.java:156)
at org.h2.message.DbException.convert(DbException.java:278)
at org.h2.table.TableData.addRow(TableData.java:137)
at org.h2.command.dml.Insert.insertRows(Insert.java:120)
...
I manage to add 10500 rows in NOTES and aproximately the same in
RESOURCES. The BINARY DATA in resources ranges from 100bytes to 25MB.
I analyzed the heapdump.hprof that I get after the OOME and it seems
that PageStore , PageDataLeaf and ValueJavaObject take a lot of heap
space (159MB , 106MB and 46.5MB respectively). I wonder if this values
are ok, given the fact that the row that I'm adding is maximum 25MB.
All the config parameters are set to their defaults. How can I reduce
the memory comsumption of my db?
Thanks/Ruben
> BINARY DATA in resources ranges from 100bytes to 25MB.
Use BLOB instead of BINARY. See also:
http://www.h2database.com/html/datatypes.html#blob_type
http://www.h2database.com/html/datatypes.html#binary_type
Regards,
Thomas