I'm considering using a virtual table to query an external-to-SQLite data 
store. However, I've carefully read about the xBestIndex method, and it appears 
that virtual tables cannot have indexes on expressions; or rather that the 
SQLite query engine can't make use of such indexes, only indexes on columns.

Consider for example a virtual table with a column named "text", and a query 
with `WHERE length(text) > 100`. In my external data store I can create an 
index on `length(text)`, but it doesn't look as though SQLite has any way of 
asking me about it, so I assume it will just brute-force scan through every row.

The only workaround I can see is to add a virtual table column for every 
possible expression that might be queried against — like "text_length" — but 
the query interface in my project is open-ended enough that I can't delimit the 
set of expressions that might need to be exposed this way. (It might be 
feasible if I could alter the table on the fly to add columns as needed, but 
the docs explicitly say I can't do that.)

—Jens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to