I need to use derby with huge tables in the project. To get some performance, I select document identifiers from three different tables into one huge table to search for a document type.
Basically a very simple request:
"INSERT INTO DOC_TYPES SELECT DOC_ID, 1 FROM TYPE_A_DOCUMENT" "INSERT INTO DOC_TYPES SELECT DOC_ID, 2 FROM TYPE_B_DOCUMENT" "INSERT INTO DOC_TYPES SELECT DOC_ID, 3 FROM TYPE_C_DOCUMENT"
When I run it in normal mode, with a derby on my hard drive, it takes about 1 minute to process, and I get about 6.5 million rows in the database (huge, I know ...)
In any case, the database is still a way to slow down my taste, so I tried to run everything in memory. Unfortunately, even with a heap size of 4 GB (the full database on my hard drive never exceeds 1 GB), the operation is pretty fast in "java / lang / OutOfMemoryError".
I do not see any alternatives or workarounds to solve this problem. Derby does not support materialized representations and does it in Java (SELECT, interate resultset, INSERT) will take several hours ...
You also cannot “smash” the expression, since Derby does not seem to support LIMIT.
Any suggestions / ideas?
Regards, Michael
source share