开发者

How to convert a MEMORY table into a CACHED one on HsqlDB?

开发者 https://www.devze.com 2023-03-03 23:18 出处:网络
I have created a HsqlDB database and inserted a lot of data in it already. The tables 开发者_如何学编程were create in default mode, i.e.,the table type is MEMORY.

I have created a HsqlDB database and inserted a lot of data in it already. The tables 开发者_如何学编程were create in default mode, i.e., the table type is MEMORY.

Not I want to switch those tables to CACHED mode since they are getting larger and larger. The HsqlDB 1.8 guide says the cached tables can be created by using command

CREATE CACHED TABEL ...

Is there any way to alter the existing tables into CACHED without losing any data?


For example, when your table name is mytable and you want to change it to cached.

With version 2.x there is a command for this:

SET TABLE mytable TYPE CACHED

With version 1.8.x you need to shutdown the database first. Then edit the .script file and modify the line for the table

CREATE MEMORY TABLE mytable to CREATE CACHED TABLE mytable

After saving the .script file, open your database as normal.

0

精彩评论

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