![]() |
VOOZH | about |
In DBMS, indexing improves data retrieval speed by organizing how data is accessed. Two key types of indexes are the Forward Index and the Inverted Index. This article explores how each works, their structure, and their role in efficient information retrieval within advanced database systems.
A Forward Index (also known as document index) maps each document to a list of terms (words or tokens) it contains.
Example:
Doc1 → [“apple”, “banana”, “fruit”]
Doc2 → [“banana”, “smoothie”, “milk”]
An Inverted Index (or posting list) maps each term to the list of documents (and optionally positions) where that term appears.
Example:
“banana” → [Doc1, Doc2]
“milk” → [Doc2]
Enhanced Form:
Include positions, term frequency (TF), etc.
“banana” → [(Doc1, pos=2), (Doc2, pos=1)]
Forward Index Construction:
Inverted Index Construction:
| Feature | Forward Index | Inverted Index |
|---|---|---|
| Primary Key | Document ID | Term / Keyword |
| Purpose | Stores document contents | Enables fast term-based lookup |
| Search Efficiency | Inefficient for term-to-document queries | Highly efficient for keyword searches |
| Construction Stage | Built first (used to create inverted index) | Built from forward index |
| Space Efficiency | Less compact | More compact and query-efficient |
| Application | Document processing, updates | Searching, ranking, retrieval |