{
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-18",
  "slug": "inverted-index",
  "term": "Inverted index",
  "aliases": [
    "Inverted file"
  ],
  "definition": "An inverted index maps extracted keys, such as text terms or array elements, to postings identifying the records that contain them.",
  "note": "Mapping: A record can contribute several keys and appear in several posting lists. PostgreSQL GIN uses operator classes to define extraction and matching; GIN is an implementation, not another name for every inverted index. [gin]\n\nDetail: Postings need not retain positions. SQLite FTS5 detail=full stores row, column and token-position information; reduced detail omits information and limits phrase and NEAR queries. Tokenization and detail settings therefore belong to the search contract. [fts5]\n\nRechecking: An index can retain too little information to decide a query alone. PostgreSQL text-search GIN omits weight labels and rechecks weight-sensitive matches against table rows. This is a documented query requirement, not evidence of damaged postings. [textsearch]\n\nRepresentation: Inversion describes the key-to-record mapping, not one physical encoding. PostgreSQL GIN uses a B-tree over keys, with posting lists or posting trees for row identities. A B-tree can therefore be part of an inverted index. [gin]\n\nMaintenance: FTS5 external content separates indexed tokens from retrieved document values. The application must keep the two aligned; internal index consistency does not establish agreement with external rows or preservation of original document bytes. [fts5] [analysis]",
  "related": [
    "fts5-external-content",
    "bitmap-index"
  ],
  "citations": [
    {
      "id": "gin",
      "title": "PostgreSQL 18: GIN indexes, sections 65.4.1, 65.4.3 and 65.4.4",
      "url": "https://www.postgresql.org/docs/18/gin.html",
      "accessed": "2026-11-18"
    },
    {
      "id": "fts5",
      "title": "SQLite FTS5: external-content tables, detail option and FTS index structure (sections 4.4, 4.6 and 9.2)",
      "url": "https://sqlite.org/fts5.html",
      "accessed": "2026-11-18"
    },
    {
      "id": "textsearch",
      "title": "PostgreSQL 18: preferred text-search indexes, weight labels and rechecking (section 12.9)",
      "url": "https://www.postgresql.org/docs/18/textsearch-indexes.html",
      "accessed": "2026-11-18"
    },
    {
      "id": "analysis",
      "title": "Hesela: index postings and external-content consistency",
      "url": "https://hesela.com/analyses/sqlite-index-runtime-dependencies/#inverted-postings",
      "accessed": "2026-11-18"
    },
    {
      "id": "detail-probe",
      "title": "Hesela: reproducible FTS5 detail-mode observations, fixture, errors and source hash",
      "url": "https://hesela.dev/research/inverted-detail/results.json",
      "accessed": "2026-11-18"
    }
  ],
  "provenance": [
    "Source synthesis of PostgreSQL 18 GIN and SQLite FTS5 documentation accessed on 2026-11-18; implementations differ. No performance benchmark or general recovery guarantee.",
    "The linked analysis includes a separately recorded, four-document SQLite 3.45.1 detail-mode probe. Twelve query cases distinguish conjunction, phrase, NEAR and column-filter behavior; this is not a replication of the text-indexing survey."
  ]
}
