[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cassandra-user
Subject:    Re: Reading data from disk
From:       Lapo Luchini <lapo () lapo ! it>
Date:       2023-01-04 11:56:40
Message-ID: tp3phq$cgc$1 () ciao ! gmane ! io
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic