| # SQLite Steady-State Query Execution Database Candidate |
|
|
| SQLite is a CPU-only embedded relational database. This release traces **only |
| the steady-state query execution phase**: a process that opens an |
| already-populated database read-only and does nothing but execute prepared |
| queries against it in a loop. |
|
|
| - Official source: https://www.sqlite.org/ |
| - SQLite version: 3.53.4, amalgamation |
| `sqlite-amalgamation-3530400.zip` from https://www.sqlite.org/2026/ |
| - Source id: `2026-07-24 19:02:57 bf7c7f30031888f4e796e429ab3978879485813aaca6f641c7b33e4e09459bcc` |
| - `sqlite3.c` sha256: `b1dd5d74ec7f29055a6684fa06fb3c2f6821c87dd38f9a458dfd2e8a1db28189` |
| - `sqlite3.h` sha256: `919e7f2e8ed1d8f56ac17b412b8971c76aa5d1a879752cc6058f75e7d5910e1d` |
| - Build: `gcc -O2 -g -no-pie -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION |
| -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_MAX_MMAP_SIZE=4294967296` |
| (see `workload/src/build.sh`) |
| - Database: 3,000,000 rows, `records(id INTEGER PRIMARY KEY, k INTEGER, v0, v1, |
| payload TEXT(64))` plus secondary index `idx_k(k)`; 4 KiB pages, 302 MB file |
| - Connection: single thread, `SQLITE_OPEN_READONLY`, `PRAGMA query_only=ON`, |
| `PRAGMA locking_mode=EXCLUSIVE`, `PRAGMA mmap_size=2 GiB`, |
| `PRAGMA cache_size=-524288` |
|
|
| ## Phase separation |
|
|
| The workload is split into two *separate binaries* so that no excluded-phase |
| code path is even reachable from the traced process: |
|
|
| | binary | phase | traced | |
| |---|---|---| |
| | `sqlite_setup` | database file allocation, `CREATE TABLE`, `CREATE INDEX`, schema initialization, bulk `INSERT` of 3,000,000 rows, `ANALYZE` | **no** | |
| | `sqlite_query` | steady-state query execution against the existing database | **yes** | |
|
|
| `sqlite_query` contains no DDL and no DML. Its only non-query work is |
| `sqlite3_open_v2()` plus four `sqlite3_prepare_v2()` calls, which together |
| account for **480,604 instructions** measured on a query-free run — less than |
| 1% of one 60,000,000-instruction fingerprint segment, and 0.014% of the |
| 3,383,340,000-instruction traced run. The first released SimPoint region begins |
| 660,000,000 instructions into the run, so no released archive contains any of |
| it. |
|
|
| ## Query mix |
|
|
| The steady-state loop runs 3 rounds of 4 query phases, all read-only and all |
| issued from statements prepared once and reset per iteration: |
|
|
| | phase | query | exercises | |
| |---|---|---| |
| | 1 | `SELECT v0,v1,payload FROM records WHERE id = ?` (60,000x/round) | rowid B-tree descent, record lookup | |
| | 2 | `SELECT id,v0 FROM records INDEXED BY idx_k WHERE k = ?` (50,000x/round) | index B-tree descent + rowid table seek, key comparison | |
| | 3 | `SELECT id,v0,v1 FROM records WHERE id BETWEEN ? AND ?` (4,900x/round, 64 rows) | cursor movement across leaf pages, cell parsing | |
| | 4 | `SELECT id,k FROM records INDEXED BY idx_k WHERE k BETWEEN ? AND ?` (5,000x/round) | covering-index cursor movement, record compare | |
|
|
| Total traced run: 3,383,340,000 fetched instructions in 57 fingerprint segments |
| of 60,000,000 instructions. Both the fingerprint pass and the four trace |
| captures execute the identical command line, and the workload is deterministic |
| (fixed LCG seeds, read-only database), so segment indices map to the same |
| instructions in both. |
|
|
| ## SimPoint selection |
|
|
| BBV clustering (SimPoint 3.2, `-maxK 5 -dim 100 -coveragePct .99`) chose k = 4. |
| The clusters recovered exactly the four query phases and their three |
| repetitions: |
|
|
| | cluster | segments | query phase | representative | |
| |---|---|---|---| |
| | 2 | 0-4, 19-22, 38-41 | rowid point lookups | 22 | |
| | 3 | 5-8, 23-27, 42-46 | index lookups | 27 | |
| | 1 | 9-13, 28-32, 47-51 | rowid range scans | 12 | |
| | 0 | 14-18, 33-37, 52-56 | index range scans | 54 | |
|
|
| SimPoint's own representative for cluster 0 was segment 56, the partial trailing |
| segment (16,512,018 instructions). It was replaced by segment 54, the |
| next-closest full segment to the cluster centroid (distance 0.0371956 vs |
| 0.0366442); see `simpoints/substitutions.txt`. Every representative's preceding |
| segment belongs to the same cluster, so each archive's warmup chunk is in the |
| same query phase as its measured chunk. |
|
|
| ## Released archives |
|
|
| Each archive holds `chunk.0000` (60,000,000-instruction warmup) plus |
| `chunk.0001` (the 60,000,000-instruction SimPoint region), i.e. |
| **120,000,000 fetched instructions**, confirmed by |
| `drcachesim -simulator_type basic_counts` (`validation/basic_counts/`). All four |
| pass `unzip -t`, have distinct sha256 values, and contain a single thread with |
| zero system-call markers. |
|
|
| ## Steady-state evidence |
|
|
| `validation/steady_state/` attributes 100% of the instructions in each released |
| archive to functions of the traced binary. Query execution accounts for |
| 85.2-96.3% of every window; the remainder is SQLite support code (memory |
| management, `sqlite3VdbeMemRelease`, etc.) and libc. Zero instructions fall in |
| any database-creation, schema-initialization, dataset-population or |
| SQL-compilation function (`excluded_phase_check.tsv`). |
|
|