开发者

HSQLDB - Changing table mode

开发者 https://www.devze.com 2023-01-22 20:23 出处:网络
Does anybody know if it\'s there any way one can change the mode of an existing table in a HSQLDB? By default, all of them are in memory mode, but by the time, some of the became very huge and thus th

Does anybody know if it's there any way one can change the mode of an existing table in a HSQLDB? By default, all of them are in memory mode, but by the time, some of the became very huge and thus they e开发者_C百科at all my (RAM) memory. I want to convert them to the "cached" mode, but I did not find any solution. However, it is very important not to get lost any existing data.

Thanks,


In version 2.0 use:

SET TABLE mytable TYPE CACHED

In earlier versions: Shutdown the database, edit the .script file and change "CREATE TABLE MYTABLE ..." or "CREATE MEMORY TABLE MYTABLE ..." to "CREATE CACHED TABLE MYTABLE" then save. When the database is opened it will change the table type. You should then shutdown the database once to finalise the change.


CACHED tables are created with the CREATE CACHED TABLE command. Only part of their data or indexes is held in memory, allowing large tables that would otherwise take up to several hundred megabytes of memory. Another advantage of cached tables is that the database engine takes less time to start up when a cached table is used for large amounts of data. The disadvantage of cached tables is a reduction in speed. Do not use cached tables if your data set is relatively small. In an application with some small tables and some large ones, it is better to use the default, MEMORY mode for the small tables.

http://hsqldb.org/doc/guide/guide.html

0

精彩评论

暂无评论...
验证码 换一张
取 消