Migrating SQL applications to Cassandra – Pattern #4

Pattern #4: Get rid of all OR operators from sql where clauses. For example, consider an SQL requirement to authenticate user by comparing the string entered by the user with either username or email or phone: select u1.* from user u1 where (u1.username = ?1 or u1.email = ?1 or u1.phone = ?1) and u1.password = … Continue reading Migrating SQL applications to Cassandra – Pattern #4

Cassandra Primary Key = ((Partitioning Key), Clustering Key): A simple explanation

Cassandra primary key (a unique identifier for a row) is made up of two parts - 1) one or more partitioning columns and 2) zero or more clustering columns. To search a table without any indexes, all partitioning columns must be provided to avoid error message: Cannot execute this query as it might involve data filtering … Continue reading Cassandra Primary Key = ((Partitioning Key), Clustering Key): A simple explanation

How and when to index data in Cassandra for fast and efficient retrieval? – A simple explanation

Cassandra is a multi-node, peer-to-peer cluster/distributed system that distributes/stores data across all nodes in the cluster. Every table in Cassandra is physically stored in multiple SSTable files spread across one or multiple nodes. Rows are spread around the cluster based on a hash of the partition key, which is the first part of the primary key. … Continue reading How and when to index data in Cassandra for fast and efficient retrieval? – A simple explanation

How does Cassandra store data? – A simple explanation

Every time a record is inserted into Cassandra - it follows the write-path as per the diagram above. First, the record is written to a commit log (on disk). All records irrespective of schema tables  are written to the commit log. The commit log enables recovery of memtable in case of hardware failure. Second,  the … Continue reading How does Cassandra store data? – A simple explanation