Cassandra: text vs varchar

前端 未结 4 916

Does anyone know the difference between the two CQL data types text and varchar in Cassandra? The Cassandra documentation describes both types as \

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 02:45

    This threw me too when I started with Cassandra.

    Both text and varchar are UTF8 encoded strings and are synonyms for each other, that is they are exactly the same thing.

    As an added side note if one comes from a relational world like MS SQL, one would perhaps also be hesitant to use these types (especially TEXT) as the primary field for an entity. TEXT is especially usually associated with big blobs of text content that don't scream primary key to ones 3rd normal form relational mind. But since all Cassandra types are essentially stored as hexadecimal byte arrays on the disk there is no real significant performance when using them as the primary key.

提交回复
热议问题