An inverted index is an index structure that reverses the usual mapping: instead of mapping each record to its values, it maps each value (or word) to a list of record IDs where that value appears.
It is heavily used in full‑text search engines and some DBMS features, especially for text columns such as title, description, or tags.
How an Inverted Index Works
For each unique word or term in the text data, the inverted index stores:
The term itself.
A posting list (or inverted list) of record IDs where the term occurs.
For example, for a table of documents:
Term
"database"→[doc1, doc5, doc8]Term
"indexing"→[doc2, doc5, doc7]
Queries such as WHERE text CONTAINS 'database AND indexing' become set operations on posting lists:
Find records common to both lists (intersection).
This makes text search much faster than scanning every document.
Why Use Inverted Indexes?
Fast keyword search: look up a word and get all matching records instantly.
Good for text‑heavy workloads: blogs, documents, logs, and product descriptions.
Supports ranking and relevance: many systems add frequency and position information to the posting lists.
For beginners, an inverted index is like a book’s index at the back, but flipped: instead of “page → topics,” it’s “topic → pages.” You look up the word, and the system tells you all documents that contain it.
Summary
An inverted index in DBMS maps terms or values to lists of record IDs, enabling fast search and retrieval in text‑heavy or document‑oriented applications. It is the core indexing technique behind many full‑text search engines and helps databases answer complex keyword queries efficiently by turning them into set operations on posting lists.