mysql内存表初始化
作者:
xxfs 点击:浏览次数:
0
网友评论 条
日期:2009-11-05 15:47:45
Tag:内存,
我现在有张内存表A,用来查询常用的数据,内存表虽然好用,速度快,但是重启数据就没了,因此我想在数据库中建立一张表B,用来保存内存表A的数据,实现 内存表A和实体表B的实时同步。对A进行 insert,update方式能快速更新到数据表B中,同时,当数据库或服务器重启后,数据表B的数据能快速写入到内存表A中
MySQL中有init file这个参数,例如在启动mysqld时可以加上 --init-file=/xx/xx来读取某个sql文件对数据库进行初始化
use test;
create table test.init_test1 engine= memory select * from test.init_test2;
如果实现insert同步
create trigger test.synctest after insert
on test.init_test1
for each row
insert into test.init_test2 values(new.id,new.content);