DEV Community

Discussion on: How does database indexing work?

Collapse
 
akashkava profile image
Akash Kava

Same as Table of Index of a book, You look up chapter name and go straight to page where that chapter starts, you don't roll page one by one till the chapter starts.

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

Why is it O(1), yet comparable? How do I implement it in JavaScript / Python (i.e. not using existing libraries)?

The point is, how can I have faster substring indices? How can I have prebuilt indices?