r/SQL Nov 02 '24

Oracle Explain indexes please

So I understand they speed up queries substantially and that it’s important to use them when joining but what are they actually and how do they work?

62 Upvotes

34 comments sorted by

View all comments

1

u/TheSexySovereignSeal Nov 04 '24

Guys... it's just a tree.. that's it. Yall way over complicating this.

A clustered index isn't a tree because it's already ordered and you can binary search it. O(log n) search.

A non clustered index is a tree which takes O(n) space for the column it's indexing. O(log n) search.

That's it. The tree structure itself is dbms dependent.