VFilter
P1 is a cursor opened using VOpen.
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 VFilter. This is the one with the shortest program; the rows that use VFilter are highlighted.
SELECT value FROM json_each('[1, 2, 3]')| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 10 | 0 | 0 | |
| 1 | VOpen | 0 | 0 | 0 | vtab:51FAF0 | 0 |
| 2 | String8 | 0 | 3 | 0 | [1, 2, 3] | 0 |
| 3 | Integer | 1 | 1 | 0 | 0 | |
| 4 | Integer | 1 | 2 | 0 | 0 | |
| 5 | VFilter | 0 | 9 | 1 | 0 | |
| 6 | VColumn | 0 | 1 | 4 | 0 | |
| 7 | ResultRow | 4 | 1 | 0 | 0 | |
| 8 | VNext | 0 | 6 | 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: Goto, Halt, Init, Integer, ResultRow, String8, Transaction, VColumn, VNext, VOpen.
What the SQLite documentation says
P1 is a cursor opened using VOpen. P2 is an address to jump to if the filtered result set is empty.
P4 is either NULL or a string that was generated by the xBestIndex method of the module. The interpretation of the P4 string is left to the module implementation.
This opcode invokes the xFilter method on the virtual table specified by P1. The integer query plan parameter to xFilter is stored in register P3. Register P3+1 stores the argc parameter to be passed to the xFilter method. Registers P3+2..P3+1+argc are the argc additional parameters which are passed to xFilter as argv. Register P3+2 becomes argv[0] when passed to xFilter.
A jump is made to P2 if the result set after filtering would be empty.
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.