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
WITHOUT ROWIDkeywords added at the end of CREATE TABLErowidthe special column that is omittedPRIMARY KEYthe clustered index for the tableCREATE TABLE IF NOT EXISTS wordcount(...) WITHOUT ROWIDthe documented example
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
- id: C1 claim: By default every SQLite row has a special rowid; WITHOUT ROWID omits that column. source: S1 evidence: "every row in SQLite has a special column, usually called the \" rowid \""
- id: C2 claim: A WITHOUT ROWID table uses a clustered index as the primary key. source: S1 evidence: "uses a Clustered Index as the primary key."
- id: C3 claim: In the implementation, the primary key index of a WITHOUT ROWID table is the pPk index on that table. source: S2 evidence: "pPk is always a WITHOUT ROWID"
Sources
- [S1] Clustered Indexes and the WITHOUT ROWID Optimization. SQLite. https://www.sqlite.org/withoutrowid.html . License: Public-Domain. Accessed 2026-11-20.
- [S2] build.c WITHOUT ROWID comments. SQLite. https://raw.githubusercontent.com/sqlite/sqlite/master/src/build.c . License: Public-Domain. Accessed 2026-11-20.
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
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.},
}
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.
- sqlite-without-rowid.table.json (table; CC-BY-4.0)
- sqlite-without-rowid.schema.json (schema; CC-BY-4.0)
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.