AggStep
Execute the xStep function for an aggregate.
An example
19 of the 178 statements we compiled against the sample database use AggStep. This is the one with the shortest program; the rows that use AggStep are highlighted.
SELECT group_concat(name) FROM artists
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 11 | 0 | 0 | |
| 1 | Null | 0 | 1 | 2 | 0 | |
| 2 | OpenRead | 1 | 6 | 0 | k(2,,) | 0 |
| 3 | Rewind | 1 | 7 | 3 | 0 | 0 |
| 4 | Column | 1 | 0 | 3 | 0 | |
| 5 | AggStep | 0 | 3 | 2 | group_concat(1) | 1 |
| 6 | Next | 1 | 4 | 0 | 1 | |
| 7 | AggFinal | 2 | 1 | 0 | group_concat(1) | 0 |
| 8 | Copy | 2 | 4 | 0 | 0 | |
| 9 | ResultRow | 4 | 1 | 0 | 0 | |
| 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: AggFinal, Column, Copy, Goto, Halt, Init, Next, Null, OpenRead, ResultRow, Rewind, Transaction.
What the SQLite documentation says
Execute the xStep function for an aggregate. The function has P5 arguments. P4 is a pointer to the FuncDef structure that specifies the function. Register P3 is the accumulator.
The P5 arguments are taken from register P2 and its successors.
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.
← AggInverse · AggStep1 →