Unusual primary keys you've designed or encountered
retained text
I'm working on a catalog of primary key patterns, and I wanted to ask if you've designed or encountered any interesting non-standard patterns. The ones that are commonly known: * entity tables with numeric IDs/UUIDs/small strings, like `users(id)`; * junction tables (composite PK made of two IDs), like `project_developers(project_id, developer_id)`; * EAV (composite PKs made of entity ID and attribute name), like `restaurant_attributes(restaurant_id, attr_name)`; * entity tables with composite PKs, like `order_items(order_id, line_number)`. Also, aggregations of all sorts with textbook PKs like `daily_sales(date, customer_id)`, etc. What other interesting designs have you seen in your practice?
document fetched 2026-09-09 10:28 · canonical https://reddit.com/r/Database/comments/1waw5ye/unusual_primary_keys_youve_designed_or_encountered