Suppose you have a cassandra schema like this:
- deviceid, timestamp , yearmonth, value
- 1 , 2020-01-01 14:30, 202001 , 23
- 1 , 2020-01-01 14:45, 202001 , 25
- 1 , 2020-01-01 15:00, 202001 , 21
- …
- 2 , 2020-01-01 14:45, 202001 , 124
- 2 , 2020-01-01 15:00, 202001 , 100
- …
With composite partition keys the :(deviceid with yearmonth)
and clustering key the: (timestamp).
I query (select) 45000 records with php driver, and java driver and the speed is 600ms.
Is this normal? Because if you have the same query in an RDBMS database like mysql it will be faster!
Advertisement
Answer
Yes, this is expected behavior. Cassandra is a write optimized database, so reads are many times more costly than writes. In addition, the more partition keys you have the worse the read performance will get. If this is a problem you may need to consider your use case and see if Cassandra is the right datastore for you.