Trace
Write P4 on the statement trace output if statement tracing is enabled.
An example
2 of the 178 statements we compiled against the sample database use Trace. This is the one with the shortest program; the rows that use Trace are highlighted.
UPDATE tracks SET price = 1.29 WHERE id = 5
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 25 | 0 | 0 | |
| 1 | Null | 0 | 1 | 2 | 0 | |
| 2 | Noop | 3 | 0 | 1 | 0 | |
| 3 | OpenWrite | 0 | 4 | 0 | 6 | 0 |
| 4 | Integer | 5 | 16 | 0 | 0 | |
| 5 | SeekRowid | 0 | 7 | 16 | 0 | |
| 6 | Rowid | 0 | 2 | 0 | 0 | |
| 7 | IsNull | 2 | 24 | 0 | 0 | |
| 8 | Rowid | 0 | 3 | 0 | 0 | |
| 9 | Null | 0 | 4 | 0 | 0 | |
| 10 | Null | 0 | 5 | 0 | 0 | |
| 11 | Null | 0 | 6 | 0 | 0 | |
| 12 | Null | 0 | 7 | 0 | 0 | |
| 13 | Null | 0 | 8 | 0 | 0 | |
| 14 | Copy | 2 | 9 | 0 | 0 | |
| 15 | Null | 0 | 10 | 0 | 0 | |
| 16 | Column | 0 | 1 | 11 | 0 | |
| 17 | Column | 0 | 2 | 12 | 0 | |
| 18 | Column | 0 | 3 | 13 | 0 | |
| 19 | Column | 0 | 4 | 14 | 0 | |
| 20 | Real | 171798692 | 15 | 1072997335 | 0 | |
| 21 | MakeRecord | 10 | 6 | 1 | DDBDDE | 0 |
| 22 | Insert | 0 | 1 | 9 | tracks | 5 |
| 23 | Program | 2 | 24 | 17 | program | 1 |
| 24 | Halt | 0 | 0 | 0 | 0 | |
| 25 | Transaction | 0 | 1 | 1 | 0 | 1 |
| 26 | Goto | 0 | 1 | 0 | 0 | |
| 0 | Init | 0 | 1 | 0 | -- TRIGGER tracks_touch | 0 |
| 1 | Trace | 2147483647 | 1 | 0 | -- UPDATE albums SET year = year WHERE id = new.album_id | 0 |
| 2 | Null | 0 | 1 | 2 | 0 | |
| 3 | Noop | 1 | 0 | 1 | 0 | |
| 4 | OpenWrite | 0 | 3 | 0 | 4 | 0 |
| 5 | Param | 9 | 7 | 0 | 0 | |
| 6 | SeekRowid | 0 | 8 | 7 | 0 | |
| 7 | Rowid | 0 | 2 | 0 | 0 | |
| 8 | IsNull | 2 | 15 | 0 | 0 | |
| 9 | Null | 0 | 3 | 0 | 0 | |
| 10 | Column | 0 | 1 | 4 | 0 | |
| 11 | Column | 0 | 2 | 5 | 0 | |
| 12 | Column | 0 | 3 | 6 | 0 | |
| 13 | MakeRecord | 3 | 4 | 1 | DDBD | 0 |
| 14 | Insert | 0 | 1 | 2 | albums | 5 |
| 15 | ResetCount | 0 | 0 | 0 | 0 | |
| 16 | Halt | 0 | 0 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Column, Copy, Goto, Halt, Init, Insert, Integer, IsNull, MakeRecord, Noop, Null, OpenWrite, Param, Program, Real, ResetCount, Rowid, SeekRowid, Transaction.
What the SQLite documentation says
Write P4 on the statement trace output if statement tracing is enabled.
Operand P1 must be 0x7fffffff and P2 must positive.
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.
← TableLock · Transaction →