>> I am expecting two usable entries in sqlite3_index_info with
>> aConstraint[i].iColumn = 0 and aConstraint[i].op ==
>> SQLITE_INDEX_CONSTRAINT_EQ for each check
>
> What actually happens is that SQLite transforms the query into
>
>    SELECT stamp, to_text(value) FROM store WHERE id IN (42,24).
>
> The xBestIndex method does not distinguish between == and IN, so only
> a single == constraint will be mentioned in the xBestIndex call.
>

How to i extract multiple values in xFilter -- int argc, sqlite3_value **argv ? 
If i specify aConstraintUsage[].argvIndex = 1 then i should expect a list of 
values (42 and 24) in argv[0].

>>
>> xBestIndex is called twice,
>>
>>   a) once with only one non-usable entry with  aConstraint[i].iColumn = 0
>> and aConstraint[i].op == SQLITE_INDEX_CONSTRAINT_EQ and
>
> Here it is checking the cost of a full table scan.
>
>>   b) once with only one usable entry with aConstraint[i].iColumn = 0 and
>> aConstraint[i].op == SQLITE_INDEX_CONSTRAINT_EQ.
>
> Here it is checking the codes of using the IN operator.  What
> estimatedCost values are you returning for these two calls.  Because
> when I run it, and the cost of the second version is less, it chooses
> the second version.  What version of SQLite are you using?

Sqlite Version = 3.8.7.1

Estimated cost and row for each call to xBestIndex (sqlite3_index_info is 
filled with the below values for each call)

a) When there is one non-usable constraint
     idxNum = 0 estimatedCost = 1000.000000 estimatedRows = 1000

b) when there is one usable constraint
    idxNum = 1 estimatedCost = 1.000000 estimatedRows = 1

xFilter is called with idxNum = 0 and argc = 0

Fiberlink Disclaimer: The information transmitted is intended only for the 
person or entity to which it is addressed and may contain confidential and/or 
privileged material.  Any review, retransmission, dissemination or other use 
of, or taking of any action in reliance upon, this information by persons or 
entities other than the intended recipient is prohibited.  If you received this 
in error, please contact the sender and delete the material from any computer.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to