Suppose that I have a huge SQLite file (say, 500[MB]). Can 10 different python instances access this file at the same time and update different records of it?. Note, the emphasis here is on different records.
For example, suppose that the SQLite file has say 1M rows:
instance 1 will deal with (and update) rows 0 – 100000
instance 2 will will deal with (and update) rows 100001 – 200000
…………………….
instance 10 will deal with (and update) rows 900001 – 1000000
Meaning, each python instance will only be updating a unique subset of the file. Will this work, or will I have serious integrity issues?
Updated, thanks to André Caron.
You can do that, but only read operations supports concurrency in SQLite, since entire database is locked on any write operation. SQLite engine will return SQLITE_BUSY status in this situation (if it exceeds default timeout for access). Also consider that this heavily depends on how good file locking is implemented for given OS and file system. In general I wouldn’t recommend to use proposed solution, especially considering that DB file is quite large, but you can try.
It will be better to use server process based database (MySQL, PostgreSQL, etc.) to implement desired app behaviour.