DEV Community

Discussion on: 1 SQL Query You Should Stop Using

lukecarrier profile image
Luke Carrier

With the disclaimer that I'm no expert, there are two different types of index:

  • Clustered indices affect the layout of the data on the disk. This is why primary key lookups are relatively fast: the database engine is able to calculate the offset within the data file where it expects to find a row from the index.
  • Non-clustered indices are an intermediary between a set of values in the row and the row's primary key. These incur an additional lookup.
abdisalan_js profile image
Abdisalan Author

Interesting, I'll have to learn more about this Luke. Good point!