Comment

Comment by kevincox

I think the biggest issue with storing large "blobs" in the DB is that you often want a different backup strategy. The DB is a mutating file so you will want to do some form of incremental backup but blobs are often unchanging. So it is often easier to pub blobs in a different file (possibly content-addressed) and avoid scanning through them checking for changes on every backup run.

Of course depending on how you do backups this may be a non-issue (ex: filesystem snapshots with native delta snapshot transfer)

It maybe also be easier if you want to launch a photo viewer for example. You can just point it at the regular file rather than extracting a temporary file from the database, launching the viewer and making sure to clean up the file when the viewer is done.

The biggest benefit is that you get consistency for free. However this is often fairly easy to manage if you have a dedicated table for external blobs and common code to read and write them.

parent kevincox 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton