Selecting a good clustering key

As mentioned previously, clustering determine the on-disk sort order for rows within a partition. But a good clustering key can also help to ensure uniqueness among the rows. Consider the table used in the preceding examples. This section will make more sense with more data, so let’s start by adding a few more rows:

INSERT INTO security_logs_by_location (location_id,day,time_in,employee_id,mailstop) VALUES ('MPLS2',20180723,'2018-07-23 9:04:59.377','tejam','M266');INSERT INTO security_logs_by_location (location_id,day,time_in,employee_id,mailstop) VALUES ('MPLS2',20180723,'2018-07-23 7:17:38.268','jeffb','M266');INSERT INTO security_logs_by_location (location_id,day,time_in,employee_id,mailstop) VALUES ('MPLS2',20180723,'2018-07-23 ...

Get Mastering Apache Cassandra 3.x - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.