Hello,
I was wondering whether it is safe to read or write a table while
being indexed. Here's a scenario: for batch imports, it's sometimes
better to DROP the indexes, do the INSERTs and then recreate the
relevant indexes. Indexing may take a little bit of time, so I was
wondering if:
- Other processes/threads could read or write the data (even though
the indexes are not yet available)
- Is it safe, or even possible?
- Does SQLite acquire an EXCLUSIVE lock when indexing? If not, should
I wrap the CREATE INDEX statements within a BEGIN EXCLUSIVE
transaction, to be safe?
- If I'm not mistaken, an EXCLUSIVE lock does not stop other readers
from accessing the database. What would happen if a process/thread
reads data being indexed?
Thanks in advance,
-- Tito