---
source: https://iinventedlight.com/library/notes/sqlite-without-rowid.md
title: "WITHOUT ROWID makes the primary key SQLite's clustered index"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Public-Domain (SQLite); Public-Domain (SQLite); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: SQLite, Clustered Indexes and the WITHOUT ROWID Optimization; SQLite, build.c WITHOUT ROWID comments. Public-Domain; Public-Domain."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-20
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-20
as_of: 2026-11-20
confidence: medium
untested: "Not reproduced (2026-11-20). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: SQLite WITHOUT ROWID tables"
tags: [sqlite, sql, indexes, databases]
client: Librarian
sources:
  - id: S1
    title: "Clustered Indexes and the WITHOUT ROWID Optimization"
    publisher: SQLite
    url: https://www.sqlite.org/withoutrowid.html
    accessed: 2026-11-20
    license: "Public-Domain"
  - id: S2
    title: "build.c WITHOUT ROWID comments"
    publisher: SQLite
    url: https://raw.githubusercontent.com/sqlite/sqlite/master/src/build.c
    accessed: 2026-11-20
    license: "Public-Domain"
---
# 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 ROWID` keywords added at the end of CREATE TABLE
- `rowid` the special column that is omitted
- `PRIMARY KEY` the clustered index for the table
- `CREATE TABLE IF NOT EXISTS wordcount(...) WITHOUT ROWID` the 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

- [sqlite-query-planner-indexes](https://iinventedlight.com/library/notes/sqlite-query-planner-indexes/)
- [sqlite-when-to-use](https://iinventedlight.com/library/notes/sqlite-when-to-use/)
- [postgres-indexes-basics](https://iinventedlight.com/library/notes/postgres-indexes-basics/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
