Hello, We're having problems controlling the memory usage of our H2 database after upgrading from 1.3.159 to 1.4.194. Previously (using version 1.3.159) the queries being run in production would consume fairly low amounts of memory and the database itself was running with a maximum heap size of 512M. With the new version of H2 (1.4.194) these same queries are requiring over 2G of heap space and still crashing due to exhausted RAM. We've tried explicitly setting the MAX_MEMORY_ROWS to 50,000 hoping that this would constrain the heap usage but again queries are crashing even with 2G of allocated heap. The only change prompting this issue is the upgrade of H2; queries and database content have remained the same during the upgrade. Is there anything that can be done with this new H2 version to constrain the heap size being consumed when a large query is executed?
The following is a description of our application environment: We are running H2 as a standalone database in single threaded mode with a single production application connecting to it. Usage of the database from the production application is entirely over JDBC. The memory problem we're seeing is specifically with the JVM running the standalone H2 database itself; the JVM running the production application is keeping its heap usage comfortably within a limit of 512M. Table sizes in the production environment are typically about 2-3 million rows. Below is a snapshot of memory usage captured from the JVM running H2 during a production run where the database crashed. You can see the spike at the end exhausting the full 2G of allocated heap then the database crashes. Previously this same query ran under version 1.3.159 in a matter of seconds and consumed only about 200-300M of RAM during execution. <https://lh3.googleusercontent.com/-sPJbLJtq0Lg/WOj8czN67rI/AAAAAAAAABs/5mQj7vKuBRUq8KJmmbFfCdp6krLIMQR9QCLcB/s1600/JConsole.png> <https://lh3.googleusercontent.com/-1v_jJszy8PI/WOj5cDkYkKI/AAAAAAAAABc/3ZdLV95dHycLEI0I4pz4tIJt6KnF10uZACLcB/s1600/JConsole.png> -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
