SQLite Forum

SQLite interface to a clangd indexed C/C++ code base
Login
For Multi-Column-Indexes in virtual tables, our xBestIndex function

a) chooses the suported index with the largest number of prefix fields (stopping at the first field with a not-equal constraint), storing the internal index number in the idxNum field

b) assigns argvIndex values based on the order of the fields in the selected index and sets the omit flag

c) assigns both cost and row estimates based in the selectivity of the selected index as determined by the number of constrained index fields

d) encodes the selection in the idxStr field (as per recent clarification, this will need base64 encoding/decoding of the current binary structure).

The VFilter function will:

a) decode the idxNum and idxStr fields

b) generate one or two full key strings

c) set up the range scan on the base data store

The xNext function just steps to the next record until the key string(s) are no longer fulfilled or EOF is reached