Live data from Hacker News

SQLite is not a toy database

antonz.org

11–20 of 364 posts

Re: SQLite is not a toy database

#11
> There is nothing more convenient than SQLite for analyzing and transforming JSON. You can select data directly from a file as if it were a regular table.

Personally I love jq[0] for this purpose. I haven't really used SQLite for working with JSON, but the examples given are very verbose.

[0] https://stedolan.github.io/jq/

Re: SQLite is not a toy database

#12
post #7

Does anyone use SQLite as their daily-driver in lieu of R or pandas for data analysis? I don't think I can use the sqlite command-line since I'd want a fully-developed plotting utility, and it seems less convenient to do the actual analysis part through a sqlite connection in python, say.

You can perform sql queries with many of the DB clients available, such as Heidi, or Deaver, and also through python.

Sqlite is OLTP though, for analytical purposes I'd use an OLAP DB like DuckDB.

IMO dumping workload in DB is nice, specially when your dataset doesn't fit in RAM.

Re: SQLite is not a toy database

#13
SQLite is so robust, that I bet most websites could use it without really needing to move onto a client/server RDBMS.[1] I use MySQL, and I know PostgreSQL has a large marketshare now, but I wonder how much of either is really necessary when you think about traffic usage alone. I know at least in my use cases, neither seem necessary.

[1]: https://sqlite.org/whentouse.html

Re: SQLite is not a toy database

#14
post #7

Does anyone use SQLite as their daily-driver in lieu of R or pandas for data analysis? I don't think I can use the sqlite command-line since I'd want a fully-developed plotting utility, and it seems less convenient to do the actual analysis part through a sqlite connection in python, say.

You can always execute SQL in pandas by passing it a connection, getting the best of both worlds.

Re: SQLite is not a toy database

#15

> There is nothing more convenient than SQLite for analyzing and transforming JSON. You can select data directly from a file as if it were a regular table. Personally I love jq[0] for this purpose. I haven't really used SQLite for working with JSON, but the examples given are very verbose. [0] https://stedolan.github.io/jq/

I never managed to wrap my head around jq syntax however

Re: SQLite is not a toy database

#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 single purpose-built client, which is great for a desktop application that wants a reliable way to store user data.

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.

That requires a level of configuration and control that is contrary to the mission of SQLite to be embedded. They don't, and shouldn't, add that kind of functionality.

Re: SQLite is not a toy database

#18
post #2

> SQLite is serverless. Maybe if you use SQLite as a file format. But if you use it like an actual database (e.g. in a web application), I find that one is best off setting up a daemon thread to queue/batch transactions.

I use a different pattern. A lot sqlite files for diff purposes (UserSession, User Files, etc each store in separate files) This way diff threads of webserver can open/query/read/write a lot of files concurrently without any issue.

Re: SQLite is not a toy database

#19
I've built a complex CRM that handles 2.1 million USD in transactions every year. It is running sqlite with a simple in-memory lru cache (just a dict) that gets purged when a mutating query (INSERT, UPDATE or DELETE) is executed. It is very simple and more than fast enough.

Friendly reminder that you shouldn't spend time fine tuning your horizontal autoscaler in k8s before making money.

Re: SQLite is not a toy database

#20

SQLite is so robust, that I bet most websites could use it without really needing to move onto a client/server RDBMS.[1] I use MySQL, and I know PostgreSQL has a large marketshare now, but I wonder how much of either is really necessary when you think about traffic usage alone. I know at least in my use cases, neither seem necessary. [1]: https://sqlite.org/whentouse.html

SQLite is very limited because of its threading model, imo it's not usable outside of the single app model where you have a single user.

https://sqlite.org/threadsafe.html

https://sqlite.org/lockingv3.html

Post reply on HN