PayToPwn
PayToPwn

Reputation: 1257

In a nosql structure using Cassandra what solution would be faster ?

In a setup with 2 nodes, using Cassandra, and given a new keyspace, which setup would be faster in performance, reading and writting, (A) a structure with all the attributes in the class or (B) several classes with their respective attributes related?

An example of (A) could be:

PRICE
=====
id: bigint
openask : float
openbid : float
closeask : float
closebid : float
date : date 
currencypair : string     

while and example of (B) could be:

PRICE
=====
id: bigint 
open: openid
close: closeid
currencypair: currencyid
date: date 

OPEN
====
openid: bigint
openbid: float
openask: float

CLOSE
=====
closeid: bigint
closebid : float
closeask : float 

CURRENCYPAIR
============
currencyid: bigint
currencyname : String

Upvotes: 1

Views: 70

Answers (1)

Abhishek Anand
Abhishek Anand

Reputation: 1992

I think you are trying to compare a no-sql database with mindset of rdbms database.

When operating with cassandra, you need to focus on using minimum queries possible. Specially for reads, because each read query will involve network trip time as well.

Now look at your requirement, it becomes so clear. Reading from your first approach will take 1 query, while reading from your second approach will take 4 queries.

Remember, in a database like cassandra, normalization in most cases is a bad idea, if your requirement is read intensive.

Upvotes: 1

Related Questions