Hi H2 developers and users,

I'm experiencing a disturbing issue that I cannot find a way to fix,
except for the unscalable solution of just increasing the heap size to
enourmous sizes. Currently I have 1gb of memory available, which
should be enough I hope.

What I have is a table with around 1.2 million records and 7 columns
in it. I need to make a query to find the unique records of the table,
so I do a COUNT(*) and GROUP BY query like this:

SELECT a,b,c,d,e,f,g,COUNT(*) FROM my_table GROUP BY a,b,c,d,e,f,g

And this runs out of memory :-(

I've tried tweaking by issuing this, but it didn't work:
SET MAX_MEMORY_ROWS 500

My connection type is local filebased, like this:
jdbc:h2:c:\my_db

Is there any way to prevent this from happening, by using a more disk-
oriented caching mechanism or such? I hope so because I expect the
table to grow in size without having to increase the heap size all the
time. Execution speed is a minor issue, so a lesser performing
solution is OK.

Here's the stack trace of H2:

Caused by: java.lang.OutOfMemoryError: Java heap space
        at org.h2.value.Value.cache(Value.java:338)
        at org.h2.value.ValueString.get(ValueString.java:127)
        at org.h2.store.Data.readValue(Data.java:747)
        at org.h2.index.PageDataIndex.readRow(PageDataIndex.java:416)
        at org.h2.index.PageDataLeaf.getRowAt(PageDataLeaf.java:327)
        at org.h2.index.PageDataCursor.nextRow(PageDataCursor.java:97)
        at org.h2.index.PageDataCursor.next(PageDataCursor.java:49)
        at org.h2.index.IndexCursor.next(IndexCursor.java:222)
        at org.h2.table.TableFilter.next(TableFilter.java:342)
        at org.h2.command.dml.Select.queryGroup(Select.java:311)
        at org.h2.command.dml.Select.queryWithoutCache(Select.java:592)
        at org.h2.command.dml.Query.query(Query.java:257)
        at org.h2.command.dml.Query.query(Query.java:227)
        at org.h2.command.CommandContainer.query(CommandContainer.java:78)
        at org.h2.command.Command.executeQuery(Command.java:178)
        at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:77)

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to