System Design
4. Database FundamentalsAnimated
Composite Keys
A key made of several columns together.
The idea
The combination of columns is unique even if each column alone is not.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- client
- gateway / proxy
- service
- cache
- data store
- queue / stream
Presentation tier: the browser shows the interface.
- step:
- 1/4
- at:
- Browser
1/9
The green dot is a request moving through the system.
Step by step
- 1Pick the columns that together identify a row
- 2Declare them as the key
- 3Index them together
- 4Query using the leading columns
Where it is used
Join tables such as student-course.
Watch out for
Column order matters for index use.