SQLite VDBE opcode

IdxGT

The P4 register values beginning with P3 form an unpacked index key that omits the PRIMARY 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

31 of the 178 statements we compiled against the sample database use IdxGT. This is the one with the shortest program; the rows that use IdxGT are highlighted.

SELECT name FROM artists WHERE name BETWEEN 'A' AND 'F'
addropcodep1p2p3p4p5
0Init01000
1OpenRead160k(2,,)0
2String8010A0
3SeekGE19110
4String8010F0
5IdxGT19110
6Column1020
7ResultRow2100
8Next1500
9Halt0000
10Transaction00101
11Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: Column, Goto, Halt, Init, Next, OpenRead, ResultRow, SeekGE, String8, Transaction.

What the SQLite documentation says

The P4 register values beginning with P3 form an unpacked index key that omits the PRIMARY KEY. Compare this key value against the index that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID fields at the end.

If the P1 index entry is greater than the key value then jump to P2. Otherwise fall through to the next instruction.

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.

← IdxGE · IdxInsert →