开发者社区> 问答> 正文

这个查询语句有时候可以查到 有时候又查不不到数据

这个查询语句有时候可以查到 有时候又查不不到数据
CREATE TABLE IF NOT EXISTS api_stats (

app_name                    text,               -- 目标应用

-- 被其它应用访问数据
count                       int,                -- 被访问次数
err_count                   int,                -- 被访问错误数
duration                    int,                -- 被访问总耗时
max_duration                int,                -- 最大访问耗时
min_duration                int,                -- 最小访问耗时
satisfaction                int,               -- 满意
tolerate                    int,                -- 可容忍
api                         text,               -- 目标应用被访问的api
input_date                  bigint,
PRIMARY KEY (app_name, api, input_date)

) WITH gc_grace_seconds = 10800 AND default_time_to_live = 2592000;

CREATE CUSTOM INDEX IF NOT EXISTS ON api_stats (input_date)

USING 'org.apache.cassandra.index.sasi.SASIIndex' 
WITH OPTIONS = {'mode': 'SPARSE'};

展开
收起
小六码奴 2019-06-14 16:14:41 2754 0
1 条回答
写回答
取消 提交回答
  • 读写都设置一致性级别,比如quorum另外gc_grace_seconds这个周期内要主动做做node repair这个意思是可能写了一副本成功了,你读有时候落到成功的node上,有时候落到失败的node上了,自然时有时无,推荐发起强一致性读

    2019-07-17 23:37:14
    赞同 展开评论 打赏
问答分类:
API
问答地址:
相关产品:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载