Bharath Booshan L
<[EMAIL PROTECTED]> wrote:
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.
Correct. If you want it indexed, create an index on it.
But when I index Book(LibraryID) it is quick enough. But is it
meaningful to
index Foreign Key ?
As long as it improves performance of a query you need, why not?
Will the Foreign key use the same index as of its counterpart in
original
table or should it be separately indexed ?
Separate index, of course. There ain't no such thing as an index shared
between two tables.
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 :(
EXPLAIN QUERY PLAN first appeared in SQLite v3.2.6. The version you use
doesn't support it.
Igor Tandetnik
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------