cassandra primary key. performance implications if integer vs varchar

我与影子孤独终老i 提交于 2019-12-23 09:32:23

问题


In Cassandra , Will there be performance penalty if primary key is varchar instead of int or bigint ? I have id as primary key. I wont do any math operation on that. I use id just to insert,retrive compare. I want to change that to string for one of my requirements. Will the perforamnce go down ?


回答1:


There won't be any noticeable difference. Primary key lookups are done on the token i.e. the hash of the key. The comparisons are therefore independent of the data type or size of the key.

Longer keys will take slightly longer to hash. And there are some internal comparisons on the raw key but I very much doubt any of this is significant so go ahead and use whatever type is best for your data.



来源:https://stackoverflow.com/questions/20692446/cassandra-primary-key-performance-implications-if-integer-vs-varchar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!