I am using sqlite v3.1.3 on Mac OS 10.4

Consider the following schema

Create table Library(LibraryID INTEGER PRIMARY KEY AUTOINCRMENT, LibraryName
TEXT);
Create table Book(LibraryID INTEGER REFERENCES Library, BookID TEXT PRIMARY
KEY, BookName TEXT);

Now I believe Library(LibraryID) is automatically indexed.

But when I use Book(LibrayID) field in one of my Query as below I believe it
is not indexed as the query execution takes more amount of time.

eg: SELECT * FROM Book WHERE LibraryID IN ( ... );

But when I index Book(LibraryID) it is quick enough. But is it meaningful to
index Foreign Key ?

Will the Foreign key use the same index as of its counterpart in original
table or should it be separately indexed ?

I am not able to see the Query plan through "Explain Query plan" &
".explain" command. " Explain Query plan" returns a syntax error and
.explain does nothing :(

Thanks in advance,

Bharath Booshan L.
   



-----------------------------------------------
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to