File format of the <dbname>.h2.db file

1,106 views
Skip to first unread message

sheng

unread,
Oct 28, 2010, 4:27:59 PM10/28/10
to H2 Database
Hi,

I've been looking around for the document that explains the detail of
the file format of the h2 db file, but couldn't find any. Is there any
documents that explains the file format of the <dbname>.h2.db file? So
that I can know how to interpret the header of the db file, and also
understand how does tables and rows being stored in the <dbname>.h2.db
file.

Regards,
Sheng

Thotheolh

unread,
Oct 28, 2010, 7:33:28 PM10/28/10
to H2 Database
I think there is no documentation for either the old or new h2
database files. I have been searching for them in the documentations
for sometime and there were none to be found. It is better off using
them standard H2 engine to handle databases.

Regards,
Thotheolh.

Thomas Mueller

unread,
Oct 30, 2010, 7:31:07 AM10/30/10
to h2-da...@googlegroups.com
Hi,

I will document the file format, but currently it's not a priority.
Why do you need it?

Regards,
Thomas

sheng

unread,
Nov 1, 2010, 2:07:33 PM11/1/10
to H2 Database
On Oct 30, 4:31 am, Thomas Mueller <thomas.tom.muel...@gmail.com>
wrote:
>
> I will document the file format, but currently it's not a priority.
> Why do you need it?

Hi Thomas,

Thanks for the reply. The reason why I tried to ask the file format is
because of a slow table scanning operations in my production
environment.

We have a h2 database dump from production. I ran a simple query that
needs table scanning against the dump, and the query took 30 minutes
to finish. So I did a SHUTDOWN DEFRAG operation to the dump, and re-do
the same table scanning query, however, this time it only took 30
seconds to finish, which is 60 times faster than before the defrag. I
am wondering if the problem I saw is related to the file format?

I am also interested in the basic operations of insert and update,
since they are the major operations that had been done to the my h2
dump.

Here are more details about the investigation I did earlier to the
slow h2 dump. http://groups.google.com/group/h2-database/browse_thread/thread/629fb1d59cc85a17

Regard,
Sheng

Thomas Mueller

unread,
Nov 3, 2010, 5:57:00 PM11/3/10
to h2-da...@googlegroups.com
Hi,

The file format is already documented somewhat in the class javadoc of
the following classes:

PageStore, PageLog, PageStreamTrunk, PageStreamData, PageFreeList,
PageDataLeaf, PageDataNode, PageDataOverflow, PageBtreeLeaf,
PageBtreeNode. The variable size int and value serialization is found
in the class Data.

> I am also interested in the basic operations of insert and update,
> since they are the major operations that had been done to the my h2
> dump.

I think you are mainly interested in PageBtreeIndex, -Leaf, -Node and
PageDataIndex, -Leaf, -Node then.

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages