I'm fairly confident this is AI generated, but it makes me think regardless: Whenever I see these kind of articles, I'm left wondering if they've actually used SQLite in production because I always see points about how to optimize performance, like using the WAL, but never about annoyances/issues you'd run into before even needing to worry about that. I guess it's the zeitgeist to use it in a production setting, and…
SQLite supports ALTER TABLE: https://www.sqlite.org/lang_altertable.html On Go you can embed your migrations in your binary: https://oscarforner.com/blog/2023-10-10-go-embed-for-migrati...
SQLite in Production: Optimizing WAL Mode, Concurrency, and VFS Layers
71–80 of 87 posts
Re: SQLite in Production: Optimizing WAL Mode, Concurrency, and VFS Layers
#72"If the database size is smaller than the mmap_size, the entire database is mapped into memory, turning disk reads into simple pointer arithmetic." hah so that's how it works?
Re: SQLite in Production: Optimizing WAL Mode, Concurrency, and VFS Layers
#73Personally, I think the better way to tackle sqlite_busy is to have a single writer managed at the application level. That effectively eliminates sqlite_busy in the context of a single process. > To ensure write operations don't suffer from disk synchronization bottlenecks, pair WAL mode with the following pragma Only do this if you are prepared to sacrifice durability (i.e can afford to lose transactions).
Re: SQLite in Production: Optimizing WAL Mode, Concurrency, and VFS Layers
#74Where I part ways a little with the recommendation is in the busy_timeout + BEGIN IMMEDIATE suggestion. On an embedded system, that's not really sufficient; I maintain a caching service that is used by thousands of clients. It ingests data over MQTT and has a web interface for queries. In my design, there is a MQTT thread and pruning thread. The MQTT ingestion thread and the pruning thread can both end up "contending…
> Meanwhile, you might be surprised how often “single-tenant edge deployment” comes up in embedded contexts; a Pi with an SD card is a common configuration for an embedded database, and it's right at the intersection of these problems.
Probably shouldn't be. One of the more high profile use cases for SQLite is per-customer sharding. Particularly with services where at any given time a small number of customers are generating the majority of the traffic. The data for customers that you haven't seen logged in for weeks tends to have a logarithmic effect on the query time for active customers when you use a single shared database for all of the data. Unloading that data reduces the cost of interactive workloads handily, even though the cost of backups may still be either the same or still have a logarithmic cost (eg, rsync detects deltas).
Re: SQLite in Production: Optimizing WAL Mode, Concurrency, and VFS Layers
#75Unfortunately written by an AI - that completely takes the wind out of the content and makes me not even want to read any further. The distinction between “production” and “non-production” is also questionable. For an evaluation, I recommend the following original articles (certainly not AI-generated): - https://sqlite.org/whentouse.html - https://sqlite.org/different.html - https://sqlite.org/quirks.html
I have to disagree with this as off topic. The blog lists ways to optimize sqlite for production, for those who have already made that choice. But these comment links are about choosing sqlite vs others and differences, which is completely unrelated and unnecessary for those who have already made that choice. I'm seeing a worrying trend on HN. Nearly for all articles, there is one unquantified, unproven comment at th…
Re: SQLite in Production: Optimizing WAL Mode, Concurrency, and VFS Layers
#76Earlier quoted context omitted.
I dunno, not losing data and minimizing unnecessary downtime is table-stakes for a pretty significant class of businesses. If for no other reason, dealing with these at any scale often distracts from running your actual business.
Sqlite with litestream has a smaller default window of data loss than RDF. 1s vs 5 minutes.
Re: SQLite in Production: Optimizing WAL Mode, Concurrency, and VFS Layers
#77Unfortunately written by an AI - that completely takes the wind out of the content and makes me not even want to read any further. The distinction between “production” and “non-production” is also questionable. For an evaluation, I recommend the following original articles (certainly not AI-generated): - https://sqlite.org/whentouse.html - https://sqlite.org/different.html - https://sqlite.org/quirks.html
I have to disagree with this as off topic. The blog lists ways to optimize sqlite for production, for those who have already made that choice. But these comment links are about choosing sqlite vs others and differences, which is completely unrelated and unnecessary for those who have already made that choice. I'm seeing a worrying trend on HN. Nearly for all articles, there is one unquantified, unproven comment at th…
That's the whole reason why many here put the effort to read/post articles and argue over comments: so there's something non-obvious to be learned. LLMs are effectively "knowledge averagers". They will put together a pretty article that's not worth reading, except maybe if the problem space is completely new to you. And that's the kind of disclaimer I would hope to see ahead of anything LLM-produced, and particularly on this website.
Re: SQLite in Production: Optimizing WAL Mode, Concurrency, and VFS Layers
#78Re: SQLite in Production: Optimizing WAL Mode, Concurrency, and VFS Layers
#79Unfortunately written by an AI - that completely takes the wind out of the content and makes me not even want to read any further. The distinction between “production” and “non-production” is also questionable. For an evaluation, I recommend the following original articles (certainly not AI-generated): - https://sqlite.org/whentouse.html - https://sqlite.org/different.html - https://sqlite.org/quirks.html
I don't think the all-too-common "written by AI" remarks are helpful.
The article was informative and useful. That's what matters IMHO.
Re: SQLite in Production: Optimizing WAL Mode, Concurrency, and VFS Layers
#80Earlier quoted context omitted.
Even your comment looks like it's generated by AI.
I think this is deliberate to make a point. Even an AI doesn't use that many em dashes. GP wants you to question it as a "haha see? I'm human yet you called me an AI just like I thought!"