{
  "slug": "secondary-index",
  "term": "Secondary index",
  "aliases": [],
  "definition": "A secondary index is a separate access structure that supports searches without defining the table's main row-storage organization.",
  "note": "Secondary describes separation from the table's row storage, not whether an index enforces a primary key. All PostgreSQL indexes are secondary in this sense. A covering index may supply query values without a heap read, but visibility checks can still require one. [pg-secondary]\n\nFor an InnoDB table with a declared primary key, secondary records include that key as the locator for the clustered row. A wide primary key therefore enlarges secondary-index storage too. [innodb-indexes]\n\nSQLite secondary indexes use rowid for ordinary tables and primary-key columns for WITHOUT ROWID tables. In a WITHOUT ROWID secondary index, a key column already present with the same collation is not repeated in the locator suffix. The locator representation is engine-specific, not universally a physical address. [sqlite-format]",
  "related": [
    "clustered-index",
    "b-tree",
    "sqlite-without-rowid",
    "covering-index",
    "postgresql-index-only-scan"
  ],
  "citations": [
    {
      "id": "pg-secondary",
      "title": "PostgreSQL 18: Index-Only Scans and Covering Indexes",
      "url": "https://www.postgresql.org/docs/18/indexes-index-only-scans.html",
      "accessed": "2026-11-18"
    },
    {
      "id": "innodb-indexes",
      "title": "MySQL 8.4: Clustered and Secondary Indexes",
      "url": "https://dev.mysql.com/doc/refman/8.4/en/innodb-index-types.html",
      "accessed": "2026-11-18"
    },
    {
      "id": "sqlite-format",
      "title": "SQLite file format: table storage and secondary-index row locators",
      "url": "https://www.sqlite.org/fileformat.html#representation_of_sql_indices",
      "accessed": "2026-11-18"
    }
  ],
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-18",
  "provenance": [
    "Terminology is scoped by storage organization rather than SQL constraint names. Existing SQLite metadata controls illustrate row locators; they do not measure total index bytes or a speedup."
  ]
}
