Live data from Hacker News

Ask HN: Have you used SQLite as a primary database?

news.ycombinator.com

11–20 of 330 posts

Re: Ask HN: Have you used SQLite as a primary database?

#12
so long as you are not trying to access the DB with more than one process, sqlite scales as far as most DBs on a single instance.

The only issue is that you'll need to take special care when backing up the DB file (but this is probably the same for most DBs even today.)

Re: Ask HN: Have you used SQLite as a primary database?

#13
Yes, I've used it for a side project of mine. It processed like 5 financial transactions in total, so I'm glad I never invested the time to build anything more robust :)

It's also powering another one and I really like the fact that I can just commit the whole DB to the GIT repo.

Re: Ask HN: Have you used SQLite as a primary database?

#14

so long as you are not trying to access the DB with more than one process, sqlite scales as far as most DBs on a single instance. The only issue is that you'll need to take special care when backing up the DB file (but this is probably the same for most DBs even today.)

It's my understanding especially with WAL mode that it's fine to read and write from multiple processes (I hope so because I do this) it's just that any write locks the entire table.

Re: Ask HN: Have you used SQLite as a primary database?

#15
A slightly unusual use-case but for my work we have our own file format which is a thinly-veiled sqlite database. Originally we used a json file but we moved to sqlite for performance reasons once the files started getting to multi-gigabyte sizes.

It works great - there are ergonomic APIs in most languages, it’s fast and reliable, and great to be able to drop into an SQL shell occasionally to work out what’s going on. A custom binary format might be slightly more optimal in some ways but using sqlite saves so much work and means a solid base we can trust.

Re: Ask HN: Have you used SQLite as a primary database?

#16

so long as you are not trying to access the DB with more than one process, sqlite scales as far as most DBs on a single instance. The only issue is that you'll need to take special care when backing up the DB file (but this is probably the same for most DBs even today.)

Note that this is specifically for write/modify operations. You can perform multiple SELECTs in parallel, so depending on the workload this may be acceptable. As the devs say: "Experience suggests that most applications need much less concurrency than their designers imagine."

https://sqlite.org/faq.html#q5

Re: Ask HN: Have you used SQLite as a primary database?

#18
My solution path for databases has been like this for a good decade:

  1) Sqlite
  2) Self-hosted Postgres
  3) Big Boy Database, with an $$$ cost. (AWS Aurora, Oracle, etc).
Most projects never leave the Sqlite level. Only one has left the Postgres level so far.

Re: Ask HN: Have you used SQLite as a primary database?

#19
My preferred production DB is PostgreSQL. However, for small experiments, SQLite is more versatile due to fewer dependencies, single binary, zero install overhead etc., so I use it often, in particular for research experiments and systems prototyping. The only thing that ever bothered me was the lack of type enforcement, which has since been improved.

Production uses: 0 (1 if my Ph.D. thesis code is included, which had some C++ code that linked against version 2 of the SQLite library).

Post reply on HN