SQLite Forum

What does, if many threads and/or processes need to write the database at the same instant, mean?
Login
So I decided to do some testing and it went really bad, with locking all over the place.

I have the following options set:

```
PRAGMA journal_mode = WAL;
PRAGMA temp_store = MEMORY;
PRAGMA synchronous = NORMAL;
PRAGMA cache_size = -64000;
```

I have a small PHP script that inserts a single row with some random data into a table.

The script gets called in a loop from just two different machines on the network.

```
SQLite3::prepare(): Unable to prepare statement: 5, database is locked in ...
```

I have tried various changes to the settings, but I get the same result. About half of the queries fails with the locking warning.

I had ecspected the queries to build up in a queue, seeing a decrease in write speed, but they don't queue, they just block.

I am thinking it is because of the multi-threaded nature of a PHP web application?

Am I missing something?