我有一个现有表,该表由timestamp
我想从现有数据中创建一个materialized view
,在该数据中将时间戳转换为该新表的主键,我想在天内查找分区(不是timestamps
),应按原始timestamp
的降序对行进行排序。例如:
原始表(我按(c1,c2)
元组查找行)
CREATE TABLE T1(
c1 int,
c2 int,
start_time timestamp,
end_time timestamp,
c3 text,
PRIMARY KEY ((c1, c2), start_time)
);
在这种新情况下,我想要一个允许按日期查找的MV-行应按时间戳排序(我每天不会产生很多行)
类似的东西(这当然是模拟的,将不起作用):
CREATE MATERIALIZED VIEW MV_T1(
date date <<< this is calulated based from start_time,
start_time timestamp,
c1 int,
c2 int,
end_time timestamp,
c3 text,
PRIMARY KEY ((start_hour), timestamp)) clustering order by timestamp;
我知道原始表中没有2行会共享完全相同的时间戳-时间戳是按顺序生成的,因此不会发生冲突
是否可以创建这个新的“小时”