Small. Fast. Reliable.
Choose any three.
*** 11,18 ****
  
    int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);
  
! Most of the input and output to and from the xBestIndex
! method occurs inside the sqlite3_index_info structure.
  The sqlite3_index_info structure looks like this:
  
    struct sqlite3_index_info {
--- 11,22 ----
  
    int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);
  
! The SQLite core communicates with the xBestIndex method
! by filling in certain fields of the sqlite3_index_info
! structure and passing a pointer to that structure into
! xBestIndex as the second parameter.  The xBestIndex method
! fills out other fields of this structure which forms the
! reply.
  The sqlite3_index_info structure looks like this:
  
    struct sqlite3_index_info {
***************
*** 57,66 ****
  By calling this method, the SQLite core is saying to the
  virtual table that it needs to access some subset of the
  rows in the virtual table and it wants to know the most
! efficient way to do that access.  This method replies
  with information that the SQLite core can then use to
  conduct an efficient search of the virtual table.
  
  *Inputs*
  
  Before calling this method, the SQLite core initializes
--- 61,76 ----
  By calling this method, the SQLite core is saying to the
  virtual table that it needs to access some subset of the
  rows in the virtual table and it wants to know the most
! efficient way to do that access.  The xBestIndex method replies
  with information that the SQLite core can then use to
  conduct an efficient search of the virtual table.
  
+ While compiling a single SQL query,
+ the SQLite core might call xBestIndex multiple times
+ with different settings in sqlite3_index_info.
+ The SQLite core will then select the combination
+ that appears to give the best performance.
+ 
  *Inputs*
  
  Before calling this method, the SQLite core initializes
***************
*** 147,157 ****
  
  Given all of the information above, the job of the
  xBestIndex method it to figure out the best way to
! search the virtual table given the available constraints
! and the desired output order of the rows.
  
! The idxNum and idxStr fields are filled with information
! that communicates an indexing strategy to to the xFilter method.
  The information in idxNum and idxStr is arbitrary as far as
  the SQLite core is concerned.  The SQLite core just copies
  the information through to the xFilter method.  Any
--- 157,167 ----
  
  Given all of the information above, the job of the
  xBestIndex method it to figure out the best way to
! search the virtual table.
  
! The xBestIndex method fills
! the idxNum and idxStr fields with information
! that communicates an indexing strategy to the xFilter method.
  The information in idxNum and idxStr is arbitrary as far as
  the SQLite core is concerned.  The SQLite core just copies
  the information through to the xFilter method.  Any
***************
*** 203,206 ****
  By default, the SQLite core double checks all constraints
  on each row of the virtual table that it receives.  If
  such a check is redundant, the xBestFilter method can
! suppress the that check by setting aConstraintUsage[].omit.
--- 213,216 ----
  By default, the SQLite core double checks all constraints
  on each row of the virtual table that it receives.  If
  such a check is redundant, the xBestFilter method can
! suppress that check by setting aConstraintUsage[].omit.