首页 > 代码库 > cassandra best practise

cassandra best practise

modeling by query.

secondary index is best on table that has many rows the contain fewer unique values (low cardinality). but,

don‘t index on high-cardinality columns,

don‘t index in table which has a counter column,

don‘t index on a frequently updated or deleted column,

don‘t abuse the index to look for a row in a large partition

 

primary key 包含rowkeys, clustering columns. 

the colustering columns are used to locate a unique record, they are ordered, by default, and have the ability to use the order by clause in the select statements, as well as MIN, MAX, LIMIT

 

date bucket pattern, partitioning by date in row keys.

 

range query on partition: 使用token function。

 

if the primary column contains only one column, the row is skinny row, otherwise, the primary key contains more than one column, it‘s called wide row.

 

valueless column,即 column value可为null。

 

cassandra best practise