CockroachDB Videos
← Back to all videos

How To Design Primary Keys & Make Your Database Faster

2024-06-18

Demos & Tutorials Performance

Description

Learn the basics of primary key design with Cockroach Labs Technical Evangelist Rob Reid. By the end of this video, you'll learn how to harness it to get the best performance from CockroachDB: How To Design Primary Keys & Make Your Database Faster 00:00 Intro and How to create a 3 node CockroachDB cluster 00:19 How to identify a primary key 00:38 Understanding EXPLAIN in a database 01:12 What happens if you don't use a covering index? 01:58 What happens if you add a covering index? 02:34 When should you use a surrogate key? 02:59 What happens when you change the primary key to the email column? (natural primary key) 04:02 What happens when you use multiple column natural keys? 04:50 How to avoid database hotspots 05:22 Closing Notes (When to use UUIDs, composite natural primary keys, and more) Further resources How to choose a primary key: https://www.cockroachlabs.com/blog/how-to-choose-a-primary-key/ Docs: Primary Keys in CockroachDB: https://www.cockroachlabs.com/docs/stable/primary-key #sql #databasetutorial #sql