IdxGT
The P4 register values beginning with P3 form an unpacked index key that omits the PRIMARY KEY.
Jumps: P2 is an instruction address. In the listings here, a jump is drawn as an arc and the address is a link.
An example
31 of the 178 statements we compiled against the sample database use IdxGT. This is the one with the shortest program; the rows that use IdxGT are highlighted.
SELECT name FROM artists WHERE name BETWEEN 'A' AND 'F'
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 10 | 0 | 0 | |
| 1 | OpenRead | 1 | 6 | 0 | k(2,,) | 0 |
| 2 | String8 | 0 | 1 | 0 | A | 0 |
| 3 | SeekGE | 1 | 9 | 1 | 1 | 0 |
| 4 | String8 | 0 | 1 | 0 | F | 0 |
| 5 | IdxGT | 1 | 9 | 1 | 1 | 0 |
| 6 | Column | 1 | 0 | 2 | 0 | |
| 7 | ResultRow | 2 | 1 | 0 | 0 | |
| 8 | Next | 1 | 5 | 0 | 0 | |
| 9 | Halt | 0 | 0 | 0 | 0 | |
| 10 | Transaction | 0 | 0 | 1 | 0 | 1 |
| 11 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Column, Goto, Halt, Init, Next, OpenRead, ResultRow, SeekGE, String8, Transaction.
What the SQLite documentation says
The P4 register values beginning with P3 form an unpacked index key that omits the PRIMARY KEY. Compare this key value against the index that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID fields at the end.
If the P1 index entry is greater than the key value then jump to P2. Otherwise fall through to the next instruction.
From sqlite.org's list of opcodes for SQLite 3.54.1, in the public domain. Opcodes are not a stable interface and change between releases.