← All notes

WITHOUT ROWID makes the primary key SQLite's clustered index

Answer: By default, every SQLite row has a special column, usually named rowid, that uniquely identifies the row inside the table. Adding the WITHOUT ROWID phrase at the end of CREATE TABLE omits that special column. The table then uses a Clustered Index as its primary key.

Syntax and guidance

There are sometimes space and performance advantages to omitting the rowid. The same page covers differences from ordinary rowid tables, benefits of WITHOUT ROWID tables, when to use WITHOUT ROWID, and how to determine if an existing table is WITHOUT ROWID.

The primary key index in build.c

In build.c, pPk is always the WITHOUT ROWID primary-key index. pIdx is some index on that same table, and it may be pPk or a different index. The first nKey entries of pIdx are ordinary columns, not a rowid or expression. Both the column and the collating sequence must match when isDupColumn compares an index to pPk.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: SQLite, Clustered Indexes and the WITHOUT ROWID Optimization; SQLite, build.c WITHOUT ROWID comments. Public-Domain; Public-Domain. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: SQLite, Clustered Indexes and the WITHOUT ROWID Optimization; SQLite, build.c WITHOUT ROWID comments. Public-Domain; Public-Domain.

Cite this

Permanent ID: iil:note:ra29eysx

iinventedlight. 2026. "WITHOUT ROWID makes the primary key SQLite's clustered index." iinventedlight Library, iil:note:ra29eysx, version of 2026-11-20. https://iinventedlight.com/library/notes/sqlite-without-rowid/. License: CC-BY-4.0.

@misc{iil_note_ra29eysx,
  author = {{iinventedlight}},
  title = {{WITHOUT ROWID makes the primary key SQLite's clustered index}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-20},
  url = {https://iinventedlight.com/library/notes/sqlite-without-rowid/},
  note = {Permanent ID iil:note:ra29eysx. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/sqlite-without-rowid.md.