Hi, antoher question that occured:

If i create an index on a temporary table, this index is created &
fully kept in memory. This leads to surprising results:
For example: I create a temporary table with ~230000 entries (which is
in plain text around 13MB). While filling the table, java used memory
stays around 10MB. When the table is filled, I create an index on one
column and the amount of memory java uses jumps to 70MB. But the real
problem is, this memory never becomes available again until the
application closes.

Why is the index like 6-7 times larger than the temporary table?
And why is it completely stored in memory, discounting the value set
for CACHE_SIZE?

If I create the same table & index persistent (not temporary), the
index is about 5MB and memory usage never exceeds 20MB.

Code used:
Class.forName("org.h2.Driver");
connection =
DriverManager.getConnection("jdbc:h2:file:filename;CACHE_SIZE=8192",
"sa", "");

connection.createStatement().execute("CREATE GLOBAL TEMPORARY TABLE
"+tableName+"(entry01 INTEGER, entry02 varchar(256), entry03 YEAR,
entry04 varchar(4), entry05 varchar(4))");

and later:
connection.createStatement().execute("CREATE INDEX IF NOT EXISTS
idx_"+tableName+"_entry01 ON "+tableName+"(entry01)");

Thx

-- 
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