IT Architecture Best Practices

In this article I will post standard patterns and best practices on certain design challenges. I aim to keep it concise which helps readability.

1. Store images in database

It is possible to store images directly in an attribute of a table in your database. This can be basically done with all database, both SQL as NoSQL oriented. It can be done in two ways:

  1. Store the binary data of the image as a large blob in an attribute. This will create huge databases with bad performance.
  2. Store the location of the file in the database and store the file in a file system.

Best practice

Use option 2 for most use cases as that is a way more efficient and effective method for storing and retrieving images.

Rationale

  • Database storage is more costly than BLOB/File storage.
  • Reading from file system is faster than from Database.