Joe C
Joe C

Reputation: 2827

How does SQLite scan a table

If a query a table has no constraints, I think SQLite does a full-scan of the table. In this case how does it scan a table?

A table has at least one index, which is either rowid, a non-int key or some composed keys. Does SQLite need to traverse the indexed B+-tree for the scan? or can it jump to the leaves of the B-tree, and traverse only the leaves w/o going through those intermediate nodes?

Upvotes: 0

Views: 131

Answers (1)

CL.
CL.

Reputation: 180020

In the database file, B-tree pages have no pointers to sibling pages (and the internal memory structures are organized in the same way), so a scan must go through the parent page(s). In practice, this is not a problem because the inner pages are more likely to be cached.

Upvotes: 1

Related Questions