While I understand that you could do this, I genuinely don't understand why. SQLite and Postgres/MySQL/etc. occupy different niches. If you need massive concurrent writes, surely that's what Postgres/MySQL/etc. is for? Their engines are built around that from the ground up. SQLite is built around a file that stores data for a single application, as opposed to being client-server with many clients. I've used it a ton…
Beyond the SQLite single-writer limitation with concurrent writes
51–60 of 75 posts
Re: Beyond the SQLite single-writer limitation with concurrent writes
#52Earlier quoted context omitted.
Agreed, Sqlite docs specifically state that its not designed for this, or rather that the solution isn't appropriate, that database as a service is appropriate when you want multiple clients writing. The entire "problem" is a side-effect of using the wrong tool for the job.
Linux was designed to run in home PCs, and we keep running it in supercomputers. It works just fine. Tools evolve.
You can justify it as a migration strategy between a file and a service but you're just hammering in screws if you try to force Sqlite to be a multi-client database.
> If there are many client programs sending SQL to the same database over a network, then use a client/server database engine instead of SQLite[1].
Re: Beyond the SQLite single-writer limitation with concurrent writes
#53While I understand that you could do this, I genuinely don't understand why. SQLite and Postgres/MySQL/etc. occupy different niches. If you need massive concurrent writes, surely that's what Postgres/MySQL/etc. is for? Their engines are built around that from the ground up. SQLite is built around a file that stores data for a single application, as opposed to being client-server with many clients. I've used it a ton…
sqlite is embedded. I understand that there might be scenarios in which multi-threaded sqlite is beneficial when an application has many concurrent writers. But taking a look at the company's website makes me wonder what the project's motivation is. The company offers a database service, which is a completely different scenario from embedded dbs. If the intention is to offer a cloud service, evolving from "sqlite" se…
I don't think those solutions are necessarily that bad. There was one the other week that offered a means of guaranteed sync to a sqlite file in the cloud. Its nice to have the infra to allow users to hop around devices and have backups. What's weird to me, is trying to magic it into a performant multi-client db which the underlying technology was never designed to be.
Re: Beyond the SQLite single-writer limitation with concurrent writes
#54Earlier quoted context omitted.
Joins and Transactions are a pretty big part of SQL. I'm no expert, but if my quick search results are right, both are lost in the separate file per table scenario.
They work just fine! Joins: https://simonwillison.net/2021/Feb/21/cross-database-queries... Transactions: https://www.sqlite.org/atomiccommit.html#_multi_file_commit
Re: Beyond the SQLite single-writer limitation with concurrent writes
#55While I understand that you could do this, I genuinely don't understand why. SQLite and Postgres/MySQL/etc. occupy different niches. If you need massive concurrent writes, surely that's what Postgres/MySQL/etc. is for? Their engines are built around that from the ground up. SQLite is built around a file that stores data for a single application, as opposed to being client-server with many clients. I've used it a ton…
Re: Beyond the SQLite single-writer limitation with concurrent writes
#56Earlier quoted context omitted.
Joins and Transactions are a pretty big part of SQL. I'm no expert, but if my quick search results are right, both are lost in the separate file per table scenario.
They work just fine! Joins: https://simonwillison.net/2021/Feb/21/cross-database-queries... Transactions: https://www.sqlite.org/atomiccommit.html#_multi_file_commit
Re: Beyond the SQLite single-writer limitation with concurrent writes
#57While I understand that you could do this, I genuinely don't understand why. SQLite and Postgres/MySQL/etc. occupy different niches. If you need massive concurrent writes, surely that's what Postgres/MySQL/etc. is for? Their engines are built around that from the ground up. SQLite is built around a file that stores data for a single application, as opposed to being client-server with many clients. I've used it a ton…
Why not take something that’s great and make it support more use cases? People are doing it the other way around too: https://pglite.dev/
Re: Beyond the SQLite single-writer limitation with concurrent writes
#58The single-writer limitation in SQLite is per-database, not per-connection. You can shard your SQLite tables into multiple database files and query across all of them from a single connection. I agree that "the single-writer limitation isn't just a theoretical concern", but it's also solvable without forking SQLite. ulimit's the limit! If your goal is resource maximization of a given computer, though, Postgres is lik…
You mean using ATTACH statement, right? If you use WAL mode, then you cannot get transaction safety / ACID with ATTACH [0]
> If the main database is ":memory:" or if the journal_mode is WAL, then transactions continue to be atomic within each individual database file. But if the host computer crashes in the middle of a COMMIT where two or more database files are updated, some of those files might get the changes where others might not.
Moreover, ATTACH do not support more than 125 databases, so that limits the shards to 125. [1]
ATTACH does not solve the concurrency problems. That's why SQLite also has a BEGIN CONCURRENT experimental branch
Re: Beyond the SQLite single-writer limitation with concurrent writes
#59While I understand that you could do this, I genuinely don't understand why. SQLite and Postgres/MySQL/etc. occupy different niches. If you need massive concurrent writes, surely that's what Postgres/MySQL/etc. is for? Their engines are built around that from the ground up. SQLite is built around a file that stores data for a single application, as opposed to being client-server with many clients. I've used it a ton…
A single application can need multiple concurrent writes
Re: Beyond the SQLite single-writer limitation with concurrent writes
#60Earlier quoted context omitted.
Linux was designed to run in home PCs, and we keep running it in supercomputers. It works just fine. Tools evolve.
Tools don't always need to evolve though. I don't want my hammer to evolve into a screwdriver too, or vice-versa. Having separate tools for separate things makes sense when the things are different enough.