Your proposal is the way to go. However, I am trying to build a small sample to demonstrate that the SQLite optimizer can wreak havoc if one is not careful. The test case name is "The freaky, the ugly, and the bad". I am trying to condense a problem in a script of 8000 source lines into a few lines so you can help me. Alas, it's back to the drawing board. The foreign key mismatch is strange. A1_INDEX and C1_INDEX are varchars (20) no mismatch. Unless something else is meant.