:::: MENU ::::

Better approach for storing images in SQL Server

  • Jun 18 / 2010
  • 0
Data Modeling and Database Design, dbDigger, Performance Tunning and Optimization

Better approach for storing images in SQL Server

Storing images in database rather than storing their path (on disk) is mostly avoided due to performance perspectives. The obvious benefit is that images are also backed up along with database and there is no need to take care of images backups separately.
On the other hand utilizing images path and getting images from disk storage system is optimal. However these are design considerations that appear rare as compared to take over of existing database.

You take over an existing database and find that instead of path of disk images are stored in tables. This situation would demand some extra consideration while working with images stored in binary format inside the tables.

Some examples of these limitations are

  • Images may not be included in distinct list
  • Images can not be used while using UNION, however you may use these with UNION ALL
  • Len() function may not be used with images, you may use DataLength() to get bytes used by image

My Suggestion:

If insert and update operations for images are rare in your scenario then it would be better option to store images in binary format when inserted along with inserting path for image on disk. Later image may be retrieved from disk through path stored in database. It would make sure that images are also backed up along with database.
Consult us to explore the Databases. Contact us