In hsqldb, in my app the size of db file is nearly 36Mb, directly
convert it into h2 db, the size of data and index file is 56Mb and
37Mb separately.
I use jdbc to execute the create and insert sql in h2, and also attemp
to use 'create memory table ...' statement, forcing the h2 load data
into memory, but after convertion, I use jdbc or other tool to connect
the h2 db file, waiting a long time and then get an out of memory
exception, I don't kown why, but obviously memory mode in this
workround is useless for me.
Refer to your suggestion, I compared memory mode and cached mode in
hsqldb, using the table structure and update statement which is
mentioned before.
Loop CACHED MEMORY
1 0.265 0.62
2 0.234 0.78
3 0.172 0.94
4 0.187 0.31
5 0.93 0.47
6 0.172 0.47
7 0.94 0.46
8 0.156 0.31
9 0.11 0.47
10 0.11 0.109
SUM 3.276 4.939
AVG 0.3276 0.4939
The cached mode is faster than memory mode~~ but the db file in cached
mode is huge for my app, normally twice the size of memory mode.
So far the size of the biggest db file in my app is about 40Mb, and no
memory problem occurred. But your recommendation is worthy, I'll
carefully testify the status of memory usage.
I forgot to introduce my tool version
hsqldb 1.8.0.10
h2 1.1.116
Execute Query 3.1.5
Regards,
Kai Guo
On Aug 26, 6:59 am, Thomas Mueller <
thomas.tom.muel...@gmail.com>
wrote:
> Hi,
>
> According to my tests, H2 is slower in this case, specially if you
> have many indexes. However, not that much slower. Do you use HSQLDB
> using CREATE TABLE or CREATE CACHED TABLE? By default HSQLDB keeps all
> rows in memory, which is faster, but can result in memory problems. H2
> also supports 'memory tables' (CREATE MEMORY TABLE).
>
> My test case:
>
> drop table test;
> create table test(id int primary key, name varchar(1000), x int);
> @LOOP 10000 insert into test values(?, space(1000), 0);
> @LOOP 10 update test set x = 1 where id < 800;
> -- H2: 2281 ms
> -- HSQLDB: 404 ms
>
> Regards,
> Thomas
>
>
>
> On Wed, Aug 19, 2009 at 12:52 PM, Caesar1985<
kaigu...@gmail.com> wrote:
>
> > Thanks for Sam Van Oort's response!
> > Following your recommendation, I check the usage of indexes. I use
> > "analyze" statement to refresh the state of indexes , and then execute
> > explain for my update statement, and the plain is like this:
>
> > ----------------------------------------------------------------------------
> > UPDATE PUBLIC.TEST
> > /* PUBLIC.I_TEST_01: MONTH = '08' AND COMPANY_ID =
> > '8a95802321afc7850121afc794e5036b' */
> > SET USER_DEFINE_NUM17 = USER_DEFINE_NUM0
> > WHERE (P.MONTH = '08') AND (P.COMPANY_ID =
> > '8a95802321afc7850121afc794e5036b')
> > ----------------------------------------------------------------------------
> >> > h2 should be more fast than hsqldb!!- Hide quoted text -
>
> - Show quoted text -