Comment by eddsh1994

3 years ago

Would it make sense to store images as blobs if I’m building a web app using SQLite then? Or is this specifically small images only? Saves having to do backups of data and images separately :)

No. This is a microbenchmark. They are really great for writing blogposts that get a lot of attention and not much more.

In reality there are other operations you wanna do on your files. Concurrent access, updates, deletes are probably not as great. Backing up a database with terrabytes of binaries inside is also non-trivial. Backing up terrabytes of files is a lot simpler.

  • Can you elaborate why would it be simpler to backup terabytes of files instead of just one?

    • Not GP but one disadvantage of updating one huge file is it's harder to do efficient incremental backups. Theoretically it can still be done if your backup software supports e.g. content-defined chunking (there was a recent HN thread about Google's rsync-with-fastcdc tool). If you choose to store your assets as separate files instead though, you can trivially have incremental backups using off-the-shelf software like plain old rsync [1].

      [1]: https://www.cyberciti.biz/faq/linux-unix-apple-osx-bsd-rsync...

      3 replies →

If this is a small project, and it saves you time and makes the backup process easier for you, it's worth trying out. I've found backing up SQLite databases with Litestream to be one of the nicest quality of life things I've found in a while.