DEV Community

Discussion on: Database 101: How social media “likes” are stored in a database

Collapse
 
philgoldenberg profile image
Phil Goldenberg

Thanks for the fun read! It makes me interested in checking out Scylla.

I do have a question that may not be related to the point of the article, but is there a reason you included the created_at field in the primary key of the posts table? I would think that the id field by itself would be enough for the PK.

Collapse
 
danielhe4rt profile image
Daniel Reis ScyllaDB

At ScyllaDB we have a Partititon Key (like Primary) and Clustering Keys (Ordering Keys).

You can only do a query using PK or CK to guarantee that your query will be faster and both data should be present in every row.

Also I forgot to put user_id as clustering key for this example :p