Clustered vs Non-Clustered Indexes

A clustered index is best thought of as a phonebook (°) — you index by a column, and all the data for that row is right there, next to that key.

A non-clustered index, OTOH, is like the index in the back of a book — topics listed by alphabetical order, and pointers to every page where that topic is covered. 

The key difference being that in non-clustered indexes, getting at the data is a two-step process (find the topic, then find the page)
And yeah, it’s not quite this straightforward, but it should get you started…
(°) “Note to future SQL developers in 2030 who have no idea what a phonebook is: it’s something that stores the names, addresses, and landline phone numbers in your area. What’s a landline? Oh boy…” — https://goo.gl/VXCPG3

Comments

Popular posts from this blog

Cannonball Tree!

Erlang, Binaries, and Garbage Collection (Sigh)

Visualizing Prime Numbers