From cassandra-user Wed Jan 04 11:56:40 2023 From: Lapo Luchini Date: Wed, 04 Jan 2023 11:56:40 +0000 To: cassandra-user Subject: Re: Reading data from disk Message-Id: X-MARC-Message: https://marc.info/?l=cassandra-user&m=167283343424790 Hi, I'm not part of the team, I reply as a fellow user. Columns which are part of the PRIMARY KEY are always indexed and used to optimize the query, but it also depends in how the partition key is defined. Details here in the docs: https://cassandra.apache.org/doc/latest/cassandra/cql/ddl.html#primary-key In the example given: CREATE TABLE t ( a int, b int, c int, d int, PRIMARY KEY ((a, b), c, d) ); …this means that (a, b) is the partition key (always needed in WHERE, as it is used to calculate the hash and thus the node that is owner of the specific row) and (c, d) are the clustering key, which are not needed in the WHERE clause, but can be used in both WHERE or ORDER BY. Generally speaking Cassandra forbids "slow queries" (they need an extra parameter to be used) so every query you can do is always either fast (and using indexes) or forbidden (returning a blocking error) so you don't need to fear about slow queries. On 2023-01-03 13:07, Inquistive allen wrote: > Hello Team, > > Here is a simple query. Whenever a select query is being run with > cluster columns in where clause, does it happen that the entire > partition is being read from disk to memory and then iterated over to > fetch the required result set. > > Or there are indexes in place which help read only specific data from > the disk > > Thanks > Allen