- 修改表的TTL,指定的数值是秒
drop table if exists test_ttl.empty_table;
create table test_ttl.empty_table
(
id int primary key,
name text
);
alter table test_ttl.empty_table with default_time_to_live= 120;
insert into test_ttl.empty_table(id, name) values(1,'111111');
insert into test_ttl.empty_table(id, name) values(2,'222222');
insert into test_ttl.empty_table(id, name) values(3,'333333');
alter table test_ttl.empty_table with default_time_to_live= 60;
insert into test_ttl.empty_table(id, name) values(4,'44444');
insert into test_ttl.empty_table(id, name) values(5,'55555');
insert into test_ttl.empty_table(id, name) values(6,'66666');
select id,name,ttl(name) from test_ttl.empty_table where id > 0 and id < 7 allow filtering ;
drop table if exists test_ttl.existsdata_table;
create table test_ttl.existsdata_table
(
id int primary key,
name text
);
insert into test_ttl.existsdata_table(id, name) values(1,'111111');
insert into test_ttl.existsdata_table(id, name) values(2,'222222');
insert into test_ttl.existsdata_table(id, name) values(3,'333333');
alter table test_ttl.existsdata_table with default_time_to_live= 120;
insert into test_ttl.existsdata_table(id, name) values(4,'4444');
insert into test_ttl.existsdata_table(id, name) values(5,'55555');
insert into test_ttl.existsdata_table(id, name) values(6,'66666');
alter table test_ttl.existsdata_table with default_time_to_live= 60;
insert into test_ttl.existsdata_table(id, name) values(7,'77777');
insert into test_ttl.existsdata_table(id, name) values(8,'88888');
insert into test_ttl.existsdata_table(id, name) values(9,'99999');
select id,name,ttl(name) from test_ttl.existsdata_table where id > 0 and id < 10 allow filtering ;