Live data from Hacker News

SQLite is not a toy database

antonz.org

231–240 of 364 posts

Re: SQLite is not a toy database

#232

sqlite is my caching layer. It's crazy fast on ssds and keeps my memory empty. There's no reason to read blobs from disk or keep them stored in memory if i'm using it.

What is the benefit of keeping memory empty?

Running lots of other things on the same machine. Most of the stuff programs store is just sitting idle doing nothing but taking up space. Move it to sqlite or disk if it's an ssd. The latency hit negligible unless you're running a gaming server.

Re: SQLite is not a toy database

#233
post #16

> There is a popular opinion among developers that SQLite is not suitable for the web, because it doesn’t support concurrent access. No, the issue is it doesn't have high availability features: failover, snapshots, concurrent backups, etc. (Edit: oops, comment pointed out it does have concurrent backups.) SQLite isn't a toy DBMS, it's an extremely capable embedded DBMS. An embedded DBMS is geared towards serving a si…

>Once you have multiple clients being developed and running concurrently, and you have production data (customer accounts that are effectively legal documents that must be preserved at all times) you want that DBMS to be an independent component. It's not principally about the concurrent performance, rather it's the administrative tasks.

For my reporting/read-only use case https://datasette.io/ solves the above beautifully.

Re: SQLite is not a toy database

#234

Earlier quoted context omitted.

To me this is obviating a lot of the advantage of SQLite over any other RDBMS.

I thought the same, but maybe it's useful if you start with SQLite and decide to scale up to a distributed RDBMS without having to rewrite too much?

Two thoughts:

SQLAlchemy, at least, lets you switch from SQLite to Postgres in a configuration file.

Isn't there a useful SQL subset which allows you to switch from one database to another without rewriting? There seems to be such a subset for C, for example, which multiple compilers all interpret the same way, and SQL is a standardized language, too.

Re: SQLite is not a toy database

#235
post #230
post #16

> There is a popular opinion among developers that SQLite is not suitable for the web, because it doesn’t support concurrent access. No, the issue is it doesn't have high availability features: failover, snapshots, concurrent backups, etc. (Edit: oops, comment pointed out it does have concurrent backups.) SQLite isn't a toy DBMS, it's an extremely capable embedded DBMS. An embedded DBMS is geared towards serving a si…

I think the biggest issue can be distilled to "lack of concurrent network access". You start getting into a lot hairy management problems with distributed file systems/copying files around. Imo part of that is just web applications tend to be not very efficient when compared to something like unix cli utilities so to get performance you end up with potentially massive amounts of horizontal scaling On the other hand,…

Right, and Expensify plausibly solved this by wrapping SQLite to produce a different DB, BedrockDb. But that shouldn't imply at all that SQLite alone could satisfy main stream web applications.

Re: SQLite is not a toy database

#236

Earlier quoted context omitted.

So if you're saying everything does support a web database... then what's the reason people aren't using it for websites? Why do you say it works for "small" websites but presumably not large ones? If it's not transactions, concurrent reading, backups, or administrative tasks... then what's the issue you run into? Genuinely curious... I'm wondering if everything I've heard about "don't use SQLite for websites" is wro…

> then what's the reason people aren't using it for websites? I'd guess the reason to be that people keep hearing things like "don't use SQLite for websites" and thus don't even try. > Why do you say it works for "small" websites but presumably not large ones? Not the GP, but the main reason I wouldn't use SQLite for a large website is that SQLite itself doesn't offer much re: failover/replication (i.e. multiple serv…

Crazy web scale folks flip from Mongo (NoSQL) to Postgres: https://www.theguardian.com/info/2018/nov/30/bye-bye-mongo-h...

Re: SQLite is not a toy database

#238

Earlier quoted context omitted.

There's also a pretty nice built-in sqlite extension for transitive closures that helps in searching hierarchical/tree structures in sqlite: https://web.archive.org/web/20141127001741/https://charlesle...

Clicking the above link takes me to https://imgur.com/32R3qLv . I fail to understand why have a blog at all if its author don't like people linking to it.

How strange, sorry, I didn't know that it did that. Just updated it to an archive link. This is the only source I know of that gives an overview of closures.c so it's worth the read.

Re: SQLite is not a toy database

#239
SQLite is beautiful. Almost a perfect database for all single-user and simple multi-user projects. I just wish it had some built-in (not as an extension) encryption, native (non-DIY) date-time and UUID types - it would actually be perfect then.

Re: SQLite is not a toy database

#240
post #119
post #63

Earlier quoted context omitted.

Which if any of these is efficient enough to run on mobile and can cerealize an entire database to localStorage?

SQLite underpins large parts of both iOS and Android, so... all of them? Whether you can serialize "an entire database" just depends on the size of the database and whether it will fit in the local storage. SQLite scales up to a few TB at least, so that is unlikely to be the bottleneck.

I don't fully get it -- this is an SQlite implementation in JavaScript, which is different from what you'd use in a native app. Unless you store it to localStorage or cookies, all variables disappear when you navigate away from the page.

Can you write an offline HTML5 webapp with any of these libraries such that it can cerealize the entire database into a string and then store that to localStorage and reload the next time?

It's an honest question and not sure why people are downvoting without giving reasons.

Post reply on HN