简体   繁体   中英

Multi-tenancy in Cassandra

We are supporting multi-tenancy. Is it better to have customer id as part of partition key or clustering column

Having customer id as part of partition key will ensure that one customers data cannot be viewed by another customer.

Having customer id as part of clustering column, developers have to ensure that customer id is part of where clause. Also takes up more space.

Is there one better way over the other ? There will impact on time-series data, since data will be partitioned by customer id and the super user having access to all customers will not be able to view time-series data correctly.

Thanks

Have customer_id as a part of your partition key. You'll need this to ensure that each customer's data is stored together.

However, make sure that customer_id is not the only partition key. If you have a time series data set with millions of rows, you won't want to attempt to store them all in the same partition (it'll get too big).

There will impact on time-series data, since data will be partitioned by customer id and the super user having access to all customers will not be able to view time-series data correctly.

This comes back to designing your tables with a query-based approach. If you have a query requirement to support queries on time series data for all (or multiple) customers at once, then you may need a table designed to support that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM