database - Cassandra 通过主键查询和列抛出错误
问题描述
架构
CREATE TABLE books (
isbn text PRIMARY KEY,
author text
);
insert into books (isbn, author) values ('111', 'Sally');
insert into books (isbn, author) values ('112', 'Fred');
insert into books (isbn, author) values ('113', 'Joe');
有了上面的数据,我就可以通过主键查询了111
select * from books where isbn = '111';
但是,当我author
输入 where 条件时,它会引发错误
select * from books where isbn = '111' and author = 'Fred';
Query 1 ERROR: Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING
我无法理解,如果数据已经被主键(只有一条记录)过滤,为什么会抛出错误?
其次,如果我使用allow filtering
对性能有什么影响吗?
编辑:https ://dzone.com/articles/apache-cassandra-and-allow-filtering给了我一些线索。
解决方案
推荐阅读
- joomla - 以编程方式删除 joomla 用户及其数据的正确方法是什么?
- typescript - Vue.js:打字稿无法识别组件中的混合数据
- javascript - 如何将 DIRECTORY 作为输入并在 HTML 和 javascript 中一一处理其中的所有文件
- azure-language-understanding - LUIS 应用程序 - 通过端点命中数获取流行意图
- node.js - 有没有办法可以在 nodejs 和 postgresql 中解决这个问题?
- symfony - VichUploader 和 LiipImagine :调整大小并保存上传的图像
- plot - 我应该如何在netlogo的“监视器”中显示程序?
- javascript - 通过节点服务器插入数据时出错
- mysql - 通过 shell 脚本连接到 mysql 数据库服务器
- javascript - Phaser 2:如何使蒙版区域不可点击