It is.  If you create the missing index then your "testcase" does not 
demonstrate any slowdown.

After this line:
   doSql(db, "create table a (id int PRIMARY KEY, name text, aid int not null, 
FOREIGN KEY(aid) REFERENCES a(id))");
insert this line:
   doSql(db, "create index aid on a (aid)");

All your problems will vanish.

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.

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.


>-----Original Message-----
>From: Yuri [mailto:y...@rawbw.com]
>Sent: Thursday, 2 August, 2018 16:37
>To: SQLite mailing list; Keith Medcalf
>Subject: Re: [sqlite] Violated failed foreign key constraint delays
>the rest of transaction ; Some foreign key violations don't trigger
>the error at all
>
>On 8/2/18 3:17 PM, Keith Medcalf wrote:
>> .lint fkey-indexes
>>
>> and it will tell you what indexes you forgot to create that cause
>the issue you are seeing.
>
>
>But this problem isn't about a missing index.
>
>
>Yuri
>
>
>




_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to