Re: Does a foreign key field need a separate index?

Simon Slavin <[email protected]>
Newsgroups gmane.comp.db.sqlite.general
Message-ID <[email protected]>
On 6 Feb 2020, at 9:23pm, Rael Bauer <[email protected]> wrote:

> Is a foreign key field automatically indexed, or will it benefit from a separately created index?

No indexes for either lookup are automatically created.  You should create indexes which will help lookup in both directions, unless one of the tables is small or a useful index exists for some other reason, e.g. because the key is declared as UNIQUE.

<https://sqlite.org/foreignkeys.html#fk_indexes>
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.