SQLite Forum

SQLite interface to a clangd indexed C/C++ code base

SQLite interface to a clangd indexed C/C++ code base

(1) By anonymous on 2021-05-25 12:54:45 [link] [source]


That thread could probably use some corrections to (probably incorrect?) statements made in that small thread about virtual tables and xBestIndex. Specifically how to implement multi-column indexing of vtables.

For sure, a manual on various techniques around virtual tables and their indexing would be welcome. The current docs are accurate, and there are many examples, but perhaps a more newbie-friendly additional approach, based on commenting existing vtables examples, would be helpful to many.

(2) By Gunter Hick (gunter_hick) on 2021-05-26 10:01:05 in reply to 1 [source]

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