SeekGT
If cursor P1 refers to an SQL table (B-Tree that uses integer keys), use the value in register P3 as a 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
5 of the 178 statements we compiled against the sample database use SeekGT. This is the one with the shortest program; the rows that use SeekGT are highlighted.
SELECT id FROM artists WHERE name > 'M'
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 8 | 0 | 0 | |
| 1 | OpenRead | 1 | 6 | 0 | k(2,,) | 0 |
| 2 | String8 | 0 | 1 | 0 | M | 0 |
| 3 | SeekGT | 1 | 7 | 1 | 1 | 0 |
| 4 | IdxRowid | 1 | 2 | 0 | 0 | |
| 5 | ResultRow | 2 | 1 | 0 | 0 | |
| 6 | Next | 1 | 4 | 0 | 0 | |
| 7 | Halt | 0 | 0 | 0 | 0 | |
| 8 | Transaction | 0 | 0 | 1 | 0 | 1 |
| 9 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Goto, Halt, IdxRowid, Init, Next, OpenRead, ResultRow, String8, Transaction.
What the SQLite documentation says
If cursor P1 refers to an SQL table (B-Tree that uses integer keys), use the value in register P3 as a key. If cursor P1 refers to an SQL index, then P3 is the first in an array of P4 registers that are used as an unpacked index key.
Reposition cursor P1 so that it points to the smallest entry that is greater than the key value. If there are no records greater than the key and P2 is not zero, then jump to P2.
This opcode leaves the cursor configured to move in forward order, from the beginning toward the end. In other words, the cursor is configured to use Next, not Prev.
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.