SQLite VDBE opcode

IdxLT

The P4 register values beginning with P3 form an unpacked index key that omits the PRIMARY KEY or ROWID.

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

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

SELECT * FROM artists WHERE name >= 'B' ORDER BY name DESC
addropcodep1p2p3p4p5
0Init01400
1Noop1500
2OpenRead02030
3OpenRead260k(2,,)0
4Last213100
5String8010B0
6IdxLT213110
7DeferredSeek2000
8IdxRowid2200
9Column2030
10Column0240
11ResultRow2300
12Prev2600
13Halt0000
14Transaction00101
15Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: Column, DeferredSeek, Goto, Halt, IdxRowid, Init, Last, Noop, OpenRead, Prev, ResultRow, String8, Transaction.

What the SQLite documentation says

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

If the P1 index entry is less 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.

← IdxLE · IdxRowid →