2

I am new to node.js.

And use Express framework and use cassandra as a database.

My question is it is possible to use join with multiple table relationship like mysql.

For e.g.,

In mysql

select * from `table1` 
left join `table2` on table1.id=table2.id
Jaydeep Mor
  • 1,690
  • 3
  • 21
  • 39
  • Possible duplicate of [Inner Join in cassandra CQL](https://stackoverflow.com/questions/16790297/inner-join-in-cassandra-cql) – Raedwald Jul 19 '17 at 10:08
  • Does this answer your question? [How to do a join queries with 2 or more tables in cassandra cql](https://stackoverflow.com/questions/17248232/how-to-do-a-join-queries-with-2-or-more-tables-in-cassandra-cql) – philipxy Nov 04 '22 at 22:39

3 Answers3

4

Short: No.

There are no joins in cassandra (and other nosql databases) - which is different from relational databases.

In cassandra the standard way is to denormalize data and maybe store multiple copies if necessary. As a rule of thumb think query first - and store your data in that way you need to query it later.

Cassandra will perform very very well if your data is evenly spread accross your cluster and the every day queries hit only one or only a few primary key(s) (to be exact - partition key).

Have a look at: http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling

And there are trainings from DataStax: https://academy.datastax.com/resources/ds220-data-modeling (and others too).

Mandraenke
  • 3,086
  • 1
  • 13
  • 26
2

No. Joins are not possible in cassandra (or any other NoSQL databases).

You should design your table in cassandra based on your query requirements. And while using NoSQL system it's recommended to de-normalize your data.

Basic Rules of Cassandra Data Modeling

undefined_variable
  • 6,180
  • 2
  • 22
  • 37
0

Basic googling returns this blog post from the company behind Cassandra: https://www.datastax.com/2015/03/how-to-do-joins-in-apache-cassandra-and-datastax-enterprise In short, it says that joins are possible via Spark or ODBC connections.

It comes down to the performance characteristics of such joins, esp. compared to making a "join" by hand, i.e. a lookup query on one table for every (relevant) row on the other. Any ideas?

V-Lamp
  • 1,630
  • 10
  • 18
  • "In short, it says that joins are possible via Spark or ODBC connections." But yeah, I admit I may have sneaked in a question too ;) – V-Lamp Sep 05 '17 at 16:48