Composite index
A composite index is a database index whose key contains multiple fields or columns, ordered according to the index definition.
Just Use Postgres!
A composite index is a database index defined over multiple columns, ordering entries first by one column and then by subsequent columns.
- How it is used
- Optimizes queries that filter or order by related columns, such as regional leaderboards and device-specific time-series ranges.
- How deep it goes
- Explains column ordering, leading-column behavior, execution plans, and caveats, but defers broader index administration.
- Examples
- Demonstrates regional player rankings, filtered score queries, and smartwatch measurements filtered by timestamp and device.
- What you can do after
- Diagnose/debug with it by creating indexes, reading EXPLAIN plans, and checking whether ordering and filters use the intended index.
MongoDB 8.0 in Action, Third Edition
A compound index is an index whose key consists of multiple document fields.
- How it is used
- Speeds recurring MongoDB queries that filter on multiple fields or sort on multiple fields.
- How deep it goes
- Defines index prefixes, works through creation commands and execution plans, and specifies sort-key order without detailing index storage internals.
- Examples
- Uses movie indexes on release year, type, IMDb rating, and title, plus theater and runtime sorting queries.
- What you can do after
- Build it from scratch with createIndex, align field order with queries and sorts, and check index use with explain("executionStats").
Read how MongoDB 8.0 in Action, Third Edition explains composite index →
Natural Language Processing in Action, Second Edition
A composite index combines multiple indexing algorithms or stages into a single retrieval structure.
- How it is used
- Uses staged vector retrieval to reduce memory pressure while supporting large-scale nearest-neighbor search.
- How deep it goes
- Defines multi-stage indexing and explains memory and configuration tradeoffs, but stops short of implementation procedures or tuning recipes.
- Examples
- Uses IVFPQ, HNSW plus PQ, NumPy quantization, Faiss, Weaviate, and a New York Times ANN comparison.
- What you can do after
- Evaluate composite-index tradeoffs and recognize when memory savings justify added configuration complexity.
Read how Natural Language Processing in Action, Second Edition explains composite index →
Related concepts
- indexingkind of · Indexing is the organization or use of positions, keys, or lookup structures to identify and retrieve selected data or elements.
- single-column indexcontrasts with · A single-column index is a database index whose key is derived from one field or column and whose entries are organized by its values.
- sorting algorithmused by · A sorting algorithm is a procedure that rearranges elements of a collection into an order determined by an ordering criterion.
- ESR ruleconfigured by · The ESR rule is a MongoDB compound-index design guideline that orders equality fields before sort fields and range fields.
- bitmap index scanuses · A bitmap index scan is a query-plan operation that uses an index to build a bitmap of matching row locations before retrieving the corresponding table rows.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


