Reputation: 20856
I have the following sql table -
ticket_info
ticket_num text
created_dt text
division text
pg text
error_count text
system_caused text
Is it ok to create all the columns part of clustering key for all the columns like this -
PRIMARY KEY((ticket_num,created_dt), division,pg,error_count,system_caused)
What is the recommended approach or max number of columns in the clustering key?
Upvotes: 1
Views: 106
Reputation: 542
Best practice for Data Modeling
While technically it is possible to use that many it would be very difficult to do any queries since you would have to "Restrict" each of those clustering columns in your SELECT statement query.
See article here for detailed example of statements with WHERE clause.
In your setup you would have to restrict the clustering columns from left to right to do a basic query:
SELECT * FROM table where pk = 1 and Clusteringk1 = 2 and Clusteringk2 = 3
...and so on
You couldn't select anything without first restricting the columns that come before it in the clustering order.
Upvotes: 1