Legitimate Uses of the Antipattern
There are good reasons to store images or other large objects in files outside the database:
-
The database is much leaner without images, because images tend to be large compared to simple datatypes like integers and strings.
-
Backing up the database is faster and the result is smaller if images are not included. You must copy images from the filesystem as a separate backup step, but this can be more manageable than a huge database backup.
-
If images are in files external to the database, it’s easier to do ad hoc image previewing or editing. For example, if you need to apply a batch edit to all your images, it’s especially good to keep images external to the database.
If these advantages of storing images ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access