On Sat, 19 Nov 2005, Matthias Teege wrote:

>Christian Smith schrieb:
>
>> Index the pairs table, like I do in my schema. You might want to index by
>> id and field as these are primarily what you use to read data in this
>
>Does it make any difference if the index is unique or not?


Yes. You'll want a unique index as a row can have only a single column of
each name. It makes no sense to have more than column of the same name,
and so makes no sense storing multiple values for the same field value of
the same id.


>
>> Now, all lookups used to implement the view are done using index lookups.
>
>Can I check that a query use the index?


You can examine the output of "explain <sql query>" in the sqlite shell.
You should get something like:

xx|OpenRead|xx|xx|(pairs autoindex 1)

for each cursor that iterates through the pairs table. There should be a
cursor per field in the view.

>
>Many thanks
>Matthias
>

-- 
    /"\
    \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
     X                           - AGAINST MS ATTACHMENTS
    / \

Reply via email to