Hey all, I've got a bit of an odd situation going on.  I have a fairly
heavily threaded app making use of SQLite (which is working beautifully for
the most part.)  However, I've run into a bit of a situation.  It seems that
I have a periodic occurrence of SQLITE_SCHEMA occurring when executing some
queries.  I've pretty much narrowed this down to the interaction of two
threads working with the database.  One is a simple insert, and the other is
a fairly complicated db processing, consisting of three parts:

1) Create a temporary table with the results of a query
2) Create an index on the temporary table
3) Use the indexed temporary table in another query

The reason I'm doing the above is that the query executed in step 3 contains
a sub-query, which can potentially return a large amount of data.  I was
finding that without any type of indexing on the data coming back from this
sub-query, my performance was unacceptable.

My theory regarding the SQLITE_SCHEMA error is that the creation of the
index on the temporary table is causing a change to the schema revision
number, but I'm not quite familiar enough with the code to verify this.  I
was hoping someone on the list could enlighten me as to:

- Whether creations of temporary tables, or the creation of indexes on these
tables incur schema updates
- If the above is the case, whether there are any strategies for avoiding
this situation.

Thanks,
Ian

Reply via email to