Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite suitable for concurrent reading?

Will an SQLite database perform well to around 50 reads/second without locking?

I'm trying to decide whether it'd be feasible for use on a PHP website that won't get 'written' to very often - it'll be mostly reads of the same data from a small handful of tables

like image 431
Brian E Avatar asked Jul 23 '10 22:07

Brian E


People also ask

Does SQLite support concurrent access?

Concurrency in SQLiteSQLite (and RSQLite) supports concurrent access to the same database, through multiple database connections, possibly from multiple processes.

Does sqlite3 support concurrency?

SQLite Version 3.0. 0 introduced a new locking and journaling mechanism designed to improve concurrency over SQLite version 2 and to reduce the writer starvation problem. The new mechanism also allows atomic commits of transactions involving multiple database files.

How many concurrent connections can SQLite handle?

High Concurrency SQLite supports an unlimited number of simultaneous readers, but it will only allow one writer at any instant in time. For many situations, this is not a problem. Writers queue up. Each application does its database work quickly and moves on, and no lock lasts for more than a few dozen milliseconds.

Is SQLite good for caching?

SQLite is capable of creating databases that are held entirely in memory. This is extremely useful for creating small, temporary databases that require no permanent storage. In-memory databases are often used to cache results pulled from a more traditional RDBMS server.


1 Answers

No problem. The concurrent reading/writing will actually be serialized by SQLite so you don't need to care about it.

For details : http://www.sqlite.org/lockingv3.html

like image 162
pierrotlefou Avatar answered Oct 04 '22 02:10

pierrotlefou