--- url: "https://use-the-index-luke.com/sql/anatomy" titulek: "Anatomy of an SQL Index: What is an SQL Index" h1: "Anatomy of an SQL Index" popis: "What does an index look like and how does it work? Learn about the B-tree, why an index doesn’t get unbalanced but can still become slow." jazyk: "en" kanonicka: "https://use-the-index-luke.com/sql/anatomy" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 05:14:40" znaku: 3675 slov: 559 kodovani: "utf-8" sha256: "1677ab4818ebfc3d5a6902829b12561262a4c4f3f326dad8199d26cb689e16d0" --- by [Markus Winand](//winand.at/home). # Anatomy of an SQL Index --- *“An index makes the query fast”* is the most basic explanation of an index I have ever seen. Although it describes the most important aspect of an index very well, it is—unfortunately—not sufficient for this book. This chapter describes the index structure in a less superficial way but doesn’t dive too deeply into details. It provides just enough insight for one to understand the SQL performance aspects discussed throughout the book. An index is a distinct structure in the database that is built using the `create index` statement. It requires its own disk space and holds a copy of the indexed table data. That means that an index is pure redundancy. Creating an index does not change the table data; it just creates a new data structure that refers to the table. A database index is, after all, very much like the index at the end of a book: it occupies its own space, it is highly redundant, and it refers to the actual information stored in a different place. ## Clustered Indexes (SQL Server, MySQL/InnoDB) SQL Server and MySQL (using InnoDB) take a broader view of what “*index*” means. They refer to tables that consist of the index structure only as *clustered indexes*. These tables are called Index-Organized Tables (IOT) in the Oracle database. [Chapter 5, “*Clustering Data: The Second Power of Indexing*”](/sql/clustering), describes them in more detail and explains their advantages and disadvantages. Searching in a database index is like searching in a printed telephone directory. The key concept is that all entries are arranged in a well-defined order. Finding data in an ordered data set is fast and easy because the sort order determines each entry’s position. #### If you like this page, you might also like … … to [subscribe my **mailing lists**](https://winand.at/lists), [get **free stickers**](https://use-the-index-luke.com/shop), [buy **my book**](https://sql-performance-explained.com/?utm_source=use-the-index-luke.com&utm_campaign=ch-anatomy&utm_medium=web) or [join a **training**](https://winand.at/sql-training/open-online-class). A database index is, however, more complex than a printed directory because it undergoes constant change. Updating a printed directory for every change is impossible for the simple reason that there is no space between existing entries to add new ones. A printed directory bypasses this problem by only handling the accumulated updates with the next printing. An SQL database cannot wait that long. It must process `insert`, `delete` and `update` statements immediately, keeping the index order without moving large amounts of data. The database combines two data structures to meet the challenge: a doubly linked list and a search tree. These two structures explain most of the database’s performance characteristics. ## Contents 1. *[The Leaf Nodes](/sql/anatomy/the-leaf-nodes)* — A doubly linked list 2. *[The B-Tree](/sql/anatomy/the-tree)* — It’s a balanced tree 3. *[Slow Indexes, Part I](/sql/anatomy/slow-indexes)* — Two ingredients make the index slow *You can’t learn everything in one day. Subscribe the newsletter via **[E-Mail](https://winand.at/lists)**, **[Bluesky](https://bsky.app/profile/winand.at)** or **[RSS](/blog/feed)** to gradually catch up. Have a look at [modern-⁠sql.com](https://modern-sql.com) as well.* ## About the Author Markus Winand provides insights into SQL and shows how different systems support it at [modern-sql.com](https://modern-sql.com). Previously he made [use-the-index-luke.com](https://use-the-index-luke.com), which is still actively maintained. Markus can be hired as trainer, speaker and consultant via [winand.at](https://winand.at).