【发布时间】:2019-04-27 03:48:22
【问题描述】:
架构
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 给了我一些线索。
【问题讨论】: