Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Scyllab和cassandra中使用静态柱?_Cassandra_Scylla - Fatal编程技术网

如何在Scyllab和cassandra中使用静态柱?

如何在Scyllab和cassandra中使用静态柱?,cassandra,scylla,Cassandra,Scylla,我是锡拉布和卡桑德拉的新手,在查询表中的数据时遇到了一些问题,以下是我创建的模式: CREATE TABLE usercontacts ( userID bigint, -- userID contactID bigint, -- Contact ID lynkApp userID contactDeviceToken text, -- Device Token

我是锡拉布和卡桑德拉的新手,在查询表中的数据时遇到了一些问题,以下是我创建的模式:

CREATE TABLE usercontacts (
  userID bigint,                        -- userID 
  contactID bigint,                     -- Contact ID lynkApp userID  
  contactDeviceToken text,              -- Device Token    
  modifyDate timestamp static ,     
  PRIMARY KEY  (contactID,userID)
);



CREATE MATERIALIZED VIEW usercontacts_by_contactid 
AS SELECT userID, contactID, contactDeviceToken,
FROM usercontacts 
contactID IS NOT NULL AND userID IS NOT NULL AND modifyDate IS NOT NULL 
-- Need to not null as these are the primary keys in main
-- table same structure as the main table
PRIMARY KEY(userID,contactID);



CREATE MATERIALIZED VIEW usercontacts_by_modifyDate 
AS SELECT userID,contactID,contactDeviceToken,modifyDate
FROM usercontacts WHERE
contactID IS NOT NULL AND userID IS NOT NULL AND modifyDate IS NOT NULL
-- Need to not null as these are the primary keys in main
-- table same structure as the main table
PRIMARY KEY (modifyDate,contactID);
我想为联系人表创建物化视图,它是
usercontacts\u by\u userid
usercontacts\u by\u modifydate

当我将modifydate(timestamp)设置为静态时,我需要以下查询:


当前无法创建包含静态列(作为主键的一部分或仅作为常规列)的物化视图

包含静态行需要在静态列更改时读取整个基表(
usercontacts
),以便可以重新计算视图行。这对性能有很大的影响

将静态行作为视图的分区键意味着对于分区的所有行,视图中只有一个条目。然而,二级索引在这种情况下确实有效,您可以使用它


目前,这对“锡拉”和“卡桑德拉”都有效。

目前无法创建包含静态列(作为主键的一部分或仅作为常规列)的物化视图

包含静态行需要在静态列更改时读取整个基表(
usercontacts
),以便可以重新计算视图行。这对性能有很大的影响

将静态行作为视图的分区键意味着对于分区的所有行,视图中只有一个条目。然而,二级索引在这种情况下确实有效,您可以使用它

目前,这对“锡拉”和“卡桑德拉”都是有效的

update usercontacts set modifydate="newdate" where contactid="contactid"
select * from usercontacts_by_modifydate where modifydate="modifydate"
delete from usercontacts where contactid="contactid"