Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Columnar storage: Cassandra vs Redshift

How is columnar storage in the context of a NoSQL database like Cassandra different from that in Redshift. If Cassandra is also a columnar storage then why isn't it used for OLAP applications like Redshift?

like image 945
p0712 Avatar asked Oct 10 '18 11:10

p0712


People also ask

Is Redshift a columnar database?

Redshift is a columnar database better suited for analytics, and thus a more appropriate platform for a data warehouse. In PostgreSQL a single database connection cannot utilize more than one CPU, while Redshift is architected for parallel processing across multiple nodes.

Is Cassandra a columnar database?

Cassandra is an open source, column-oriented database designed to handle large amounts of data across many commodity servers. Unlike a table in a relational database, different rows in the same table (column family) do not have to share the same set of columns.

Is Redshift a Cassandra?

Cassandra is a NoSQL distributed database known for its scalability and high availability. It has an open-source license, while Redshift is a data warehousing solution known for scalable data processing solutions and fast performance. Redshift supports a commercial license.


1 Answers

The storage engines of Cassandra and Redshift are very different, and are created for different cases. Cassandra's storage not really "columnar" in wide known meaning of this type of databases, like Redshift, Vertica etc, it is much more closer to key-value family in NoSQL world. The SQL syntax used in Cassandra is not any ANSI SQL, and it has very limited set of queries that can be ran there. Cassandra's engine built for fast writing and reading of records, based on key, while Redshift's engine is built for fast aggregations (MPP), and has wide support for analytical queries, and stores,encodes and compresses data on column level.

It can be easily understood with following example:

Suppose we have a table with user id and many metrics (for example weight, height, blood pressure etc...). I we will run aggregate the query in Redshift, like average weight, it will do the following (in best scenario):

  1. Master will send query to nodes.

  2. Only the data for this specific column will be fetched from storage.

  3. The query will be executed in parallel on all nodes.

  4. Final result will be fetched to master.

Running same query in Cassandra, will result in scan of all "rows", and each "row" can have several versions, and only the latest should be used in aggregation. If you familiar with any key-value store (Redis, Riak, DynamoDB etc..) it is less effective than scanning all keys there.

Cassandra many times used for analytical workflows with Spark, acting as a storage layer, while Spark acting as actual query engine, and basically shouldn't be used for analytical queries by its own. With each version released more and more aggregation capabilities are added, but it is very far from being real analytical database.

like image 160
nevsv Avatar answered Sep 30 '22 07:09

nevsv