Is ALLOW FILTERING in Cassandra for following quer

2019-07-04 23:15发布

I have a table like this:

CREATE TABLE IF NOT EXISTS Posts (
    idObject int,
    objectType text,
    idParent uuid,
    id uuid,
    idResolution uuid,
    PRIMARY KEY ((idObject, objectType, idParent), id)
);

Now have a look at the following query:

SELECT * FROM POSTS WHERE idobject = 1 AND objectType = 'COURSE' AND idParent = 00000000-0000-0000-0000-000000000000 AND idResolution = 00000000-0000-0000-0000-000000000000 ALLOW FILTERING

Now the Partition Key is completely known, so if I use ALLOW FILTERING is there going to be any performance issue because the filtering is going to be done in a known single partition?

2条回答
我命由我不由天
2楼-- · 2019-07-04 23:27

It depends on how many rows are in that particular partition, and if they are spread across multiple SSTable files. But like you said, this query is guaranteed to be limited to a single node, so it might be ok.

I'd test it out with cassandra-stress, just to be sure. That way you'll know if the query latency is acceptable to your application.

查看更多
forever°为你锁心
3楼-- · 2019-07-04 23:32

For a large partition, you are probably better off using the DataStax driver paging API. https://docs.datastax.com/en/developer/java-driver/2.1/manual/paging/

A huge partition could have some application related issues with the unbounded size you are requesting. Be safe and page on.

查看更多
登录 后发表回答