Hi Noel,
- Are you calling commit() after each batch?
Yeah i commit after every 100 million. The inserts take the same amount of time until the table has roughly around 800 million.
- What does the memory usage look like when it slows down?
The job uses 1.4% of the 8gb. So its definitely not running out of memory
- If the memory usage is fine, try hooking up a profiler likes Netbeans Profiler and see what is taking the time
I tried stack tracing to figure out which step it is on, and found the job to be doing the below process for a long time.
"main" prio=10 tid=0x000000000126a000 nid=0x4cdc runnable [0x00007f664828b000]java.lang.Thread.State: RUNNABLEat org.h2.util.CacheLRU.removeOld(CacheLRU.java:184)at org.h2.util.CacheLRU.removeOldIfRequired(CacheLRU.java:136)at org.h2.util.CacheLRU.put(CacheLRU.java:112)at org.h2.store.PageStore.getPage(PageStore.java:795)- locked <0x0000000580009338> (a org.h2.store.PageStore)at org.h2.index.PageDataIndex.getPage(PageDataIndex.java:222)at org.h2.index.PageDataNode.addRowTry(PageDataNode.java:128)at org.h2.index.PageDataIndex.addTry(PageDataIndex.java:163)at org.h2.index.PageDataIndex.add(PageDataIndex.java:128)at org.h2.table.RegularTable.addRow(RegularTable.java:127)at org.h2.command.dml.Insert.addRow(Insert.java:162)at org.h2.command.dml.Select.queryFlat(Select.java:523)at org.h2.command.dml.Select.queryWithoutCache(Select.java:617)at org.h2.command.dml.Query.query(Query.java:290)at org.h2.command.dml.Insert.insertRows(Insert.java:132)at org.h2.command.dml.Insert.update(Insert.java:84)at org.h2.command.CommandContainer.update(CommandContainer.java:71)at org.h2.command.Command.executeUpdate(Command.java:212)- locked <0x00000005800085f8> (a org.h2.engine.Database)at org.h2.jdbc.JdbcStatement.executeUpdateInternal(JdbcStatement.java:125)- locked <0x0000000580064d48> (a org.h2.engine.Session)at org.h2.jdbc.JdbcStatement.executeUpdate(JdbcStatement.java:110)Thank you.
regardsHarish
--
Harish MahadevanSoftware Product Developer
Knome Inc.25 First Street, Suite 107Cambridge, MA 02141USAhmaha...@knome.com
Phone: 617.715.1000
The Human Genome Interpretation CompanyThis e-mail is covered by the Electronic Communications Privacy Act, 18 U.S.C. §§ 2510-2521 and is legally privileged. This email contains confidential information intended only for the person(s) to whom this e-mail message is addressed. If you have received this e-mail message in error, please notify the sender immediately by telephone at (617) 715-1000 or by electronic mail (hmaha...@knome.com) and destroy the original message without making a copy. Thank you.
What version of H2 do you use? A bug related to large databases was
fixed recently (see the change log, I think version 1.3.161). But I'm
not sure this will fix the problem.
> Yeah i commit after every 100 million.
Normally I would commit once every 1000 rows or so. 100 million sounds
like way too much.
> The job uses 1.4% of the 8gb.
You should probably increase the cache size in H2 (cache_size).
What kind of indexes to you use? For example, do you use an index on
randomly distributed data? That would be a problem because it would it
basically "kills the cache".
Is there a file called <databaseName>.trace.db next to the database
file? If yes what does it contain?
Regards,
Thomas
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
> - Normally I would commit once every 1000 rows or so. 100 million
> sounds like way too much.
I forgot about: if you use CREATE TABLE(...) AS SELECT ... then a
commit every x number of rows isn't necessary. The reason is that in
this case, it's not a 'real' transaction (with all the overhead
usually required). But that's really just CREATE TABLE AS SELECT. It
should be about twice as fast as separate CREATE TABLE and then INSERT
INTO ... SELECT.
Regards,
Thomas
Regards,
Thomas
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/RZzo2iyfcg4J.
To unsubscribe from this group, send email to h2-database+unsubscribe@googlegroups.com.
The most probable location of the problem is in the
org.h2.store.PageStore code.
Why exactly are you trying to store this many rows?
I've created a test-case for this, but I'm not very motivated to chase it down, since it'll take 9 hours for a single run.
Sorry :-(
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database+unsubscribe@googlegroups.com.