Found
If P4==0 then register P3 holds a blob constructed by MakeRecord.
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
7 of the 178 statements we compiled against the sample database use Found. This is the one with the shortest program; the rows that use Found are highlighted.
SELECT DISTINCT country FROM artists
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 11 | 0 | 0 | |
| 1 | OpenEphemeral | 1 | 0 | 0 | k(1,B) | 8 |
| 2 | OpenRead | 0 | 2 | 0 | 3 | 0 |
| 3 | Rewind | 0 | 10 | 0 | 0 | |
| 4 | Column | 0 | 2 | 1 | 0 | |
| 5 | Found | 1 | 9 | 1 | 1 | 0 |
| 6 | MakeRecord | 1 | 1 | 2 | 0 | |
| 7 | IdxInsert | 1 | 2 | 1 | 1 | 16 |
| 8 | ResultRow | 1 | 1 | 0 | 0 | |
| 9 | Next | 0 | 4 | 0 | 1 | |
| 10 | Halt | 0 | 0 | 0 | 0 | |
| 11 | Transaction | 0 | 0 | 1 | 0 | 1 |
| 12 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Column, Goto, Halt, IdxInsert, Init, MakeRecord, Next, OpenEphemeral, OpenRead, ResultRow, Rewind, Transaction.
What the SQLite documentation says
If P4==0 then register P3 holds a blob constructed by MakeRecord. If P4>0 then register P3 is the first of P4 registers that form an unpacked record.
Cursor P1 is on an index btree. If the record identified by P3 and P4 is a prefix of any entry in P1 then a jump is made to P2 and P1 is left pointing at the matching entry.
This operation leaves the cursor in a state where it can be advanced in the forward direction. The Next instruction will work, but not the Prev instruction.
See also: NotFound, NoConflict, NotExists. SeekGe
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.