Tito Ciuro <[EMAIL PROTECTED]> wrote: > 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? >
Yes > 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. > You are mistaken. An EXCLUSIVE lock means that only the connection holding the lock is able to access the file. > What would happen if a process/thread > reads data being indexed? > -- D. Richard Hipp <[EMAIL PROTECTED]>