I have one table
CREATE TABLE user (
p1 int,
p2 int,
created_at timestamp,
user_name text,
c1 text,
PRIMARY KEY ((p1, p2),user_name)
) WITH additional_write_policy = '99p';
what will happen if i will run query
select * from user where p1 = 1 and p2 = 1 and user_name = 'abc' allow filtering;
will allow filtering will work here or it's just redundant in query .
Since you're filtering by the primary key columns,
ALLOW FILTERINGis redundant. When you filter by partition key and (optionally) clustering column(s), the coordinator will know which replicas store the data, and each of the contacted replicas will infer through local indexing where the data is stored at the storage level, making it an efficient Cassandra read query.In opposition, when the
ALLOW FILTERINGquery doesn't filter by all terms of the partition key, and/or filters by non-primary key columns, local replica indexing and/or global indexing will be rendered useless, making it so that a large set of replicas scan their full dataset and filter after reading - thus inefficient.The purpose of the
ALLOW FILTERINGoption is to exceptionally allow queries that require a full scan, since this type of query fails by default, as a safeguard, due to the impact risks.