question

mprkatti avatar image
mprkatti asked Erick Ramirez edited

Why is an unbounded read allowed in Cassandra?

Hi,

If I understand the basics of cassandra correctly, a statement like 'select * from mytable', where mytable has huge data across 100 tables, the above query would reach out to all the nodes to get data. this can in turn put a lot of strain on the cluster depending on the volume of data. if so why 'select * from table' without a qualifier is allowed?

cql
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

smadhavan avatar image
smadhavan answered mprkatti commented

@mprkatti, thank you for your question. Your understanding is correct that when leveraging SELECT * ... type queries on a table containing huge data that is spanned across the NoSQL Cassandra cluster, it would have to scan the entire cluster to find the data it needs to pull. There are many questions and answers available in this community portal regarding proper data modeling. I would recommend you begin with https://docs.datastax.com/en/cql-oss/3.x/cql/ddl/ddlCQLDataModelingTOC.html and the free course from the Academy. For your other question of why selecting data from a table without a qualifier is allowed, it is available to for fetching some tiny tables. Think of an example of a table having states of a country which will only have few records and querying that won't put stress on the cluster as compared to doing this on a large table. Hope that gives you a start!

2 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

mprkatti avatar image mprkatti commented ·

@smadhavan thanks for your response. as a follow up, in case of a cluster that has massive data for a particular table, is select * automatically disallowed by cassandra ? I dont have a set up to test this scenario. hence the question.

0 Likes 0 ·
smadhavan avatar image smadhavan ♦ mprkatti commented ·

@mprkatti, it is not disallowed. If you want to quickly play with Cassandra and get it know about it, you can always leverage https://www.datastax.com/dev website where you just need to have a browser with an internet connection to get going without having to install anything! Let us know how it goes.

0 Likes 0 ·