News for hackers. Stuff that matters.
Re:SQLite is not a toy database by busterarm on Thursday March 25, 2021 @11:12AM (#26581227)
Most websites/frameworks access their database through a singleton pattern/single-connection anyway.

Edit: Sometimes you have to lie and lead people down the wrong path to enlightenment... ;)

Re:SQLite is not a toy database by Thaxll on Thursday March 25, 2021 @11:14AM (#26581269)
That's not the case no, you usually access your database with thread pool. Otherwise everyone would wait until the single connection is free. Once you have a bit more users that tries to write everything will fall appart.
Re:SQLite is not a toy database by mywittyname on Thursday March 25, 2021 @11:44AM (#26581682)
One could implement a write queue and caching for the front end. That might sound like a lot of work to go through to avoid moving to a proper multi-user database. But given that writes are probably done through a handful of API endpoints, it's probably not really that much work to implement.
Re:SQLite is not a toy database by OldHand2018 on Thursday March 25, 2021 @11:33AM (#26581515)
Well, let me throw out a crazy idea:

Nobody said you have to use a single database/file. Obviously, you are going to want to spend a couple minutes thinking about referential integrity. But how often do you delete records in your web app?

Re:SQLite is not a toy database by quesera on Thursday March 25, 2021 @11:48AM (#26581725)
UPDATE is also a write, and references crossing files sounds like a nightmare.

If your deployment environment has serious constraints, I'm sure you could make it work. The product you deliver would be SQLite + custom DBI layer to hide SQLite's limitations.

It would be a lot more work, and not be as robust or scalable, compared to a more traditional selection. But I can imagine cases where it would be appropriate.

Re:SQLite is not a toy database by HelloNurse on Thursday March 25, 2021 @12:24PM (#26582194)
A big database id not an issue. Contention requires a large number of writers, not a large amount of cold data.
Re:SQLite is not a toy database by kuschku on Thursday March 25, 2021 @12:44PM (#26582458)
As an IRC client with an SQLite backend: several hundred times per second.

Per user.

While reads are more like once every day per user.

Re:SQLite is not a toy database by busterarm on Thursday March 25, 2021 @11:17AM (#26581299)
Yes.

;)

Re:SQLite is not a toy database by quesera on Thursday March 25, 2021 @11:19AM (#26581325)
Any site with real volume will have a connection pool.

All of those connections might need to write, and this is where SQLite gets tricky to implement at scale.

I love SQLite! It's perfect for many use cases, but not all. Fortunately, Postgres is also excellent.

Re:SQLite is not a toy database by trisiak on Thursday March 25, 2021 @11:19AM (#26581328)
Can you provide some examples of frameworks with such pattern? I actually have never seen it in any of the Python or Go web applications that I had a chance to work with.