Cassandra Primary Keys

cassandra-primary-kyes

1512982399

Cassandra schemas can be a bit hard to design and are especially important to
design correctly because of the distributed nature of Cassandra.  Many new
users of Cassandra try to design schemas similar to relational databases
because of CQL's similar syntax to SQL.

### Simple

```sql
CREATE TABLE example (
  key uuid PRIMARY KEY
)
```

### Composite Key

```sql
CREATE TABLE example (
  key1 text,  // partition key:  determines how data is partitioned across nodes
  key2 int,   // clustering key: determines how data is sorted within a partition
  PRIMARY KEY(key1, key2)
)
```

The goals for designing cassandra keys (stolen from the
[datastax documentation](https://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling))
are:

1.  Spread data evenly around the cluster
2.  Minimize the number of partitions read

Add note about cassandra keys
Add note about cassandra keys
