On 8/2/18 3:46 PM, Keith Medcalf wrote:
You are required to have a UNIQUE index on the PARENT KEYS in a foreign key
relationship.
Depending on whether the PARENT:CHILD is 1:1 or 1:N you need either a UNIQUE
(1:1) or regular index on the child key.
Why is index on PARENT KEY in a foreign key relationship required for
inserts? Missing index should slow down deletion of the target record in
FK, but insertions shouldn't need checking if such parent key is already
present or not. Insertion in the parent part of FK checks if the target
exists or not. If it exists, insertion succeeds, if not, it fails. It
doesn't need to check if another parent key already exists.
Yuri
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users