cassandra select速度vs rdbms

wvt8vs2t  于 2021-06-13  发布在  Cassandra
关注(0)|答案(1)|浏览(368)

假设您有这样一个cassandra模式:
设备ID,时间戳,年月,值
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
...
对于复合分区键:(deviceid with yearmonth)和集群键:(timestamp)。
我用php驱动程序和java驱动程序查询(选择)45000条记录,速度是600ms,这正常吗?因为如果在像mysql这样的rdbms数据库中有相同的查询,它会更快!

2hh7jdfx

2hh7jdfx1#

是的,这是预期的行为。cassandra是一个写优化的数据库,所以读的成本是写的很多倍。此外,分区键越多,读取性能就会越差。如果这是一个问题,您可能需要考虑您的用例,看看cassandra是否适合您。

相关问题