Tuesday, December 15, 2009

Where we need to Store images, in SQL database or in separate folder while development?

These two ways are OK. My suggestion is to store images into sql database if there are no much more images, otherwise, it's better store them into file system because you can store them no matter how many there are.

Advantages of Storing BLOB Data in the Database:

Storing BLOB data in the database offers a number of advantages:
It is easier to keep the BLOB data synchronized with the remaining items in the row.
  1. BLOB data is backed up with the database. Having a single storage system can ease administration.
  2. BLOB data can be accessed through XML support in SQL Server 2005, which can return a base 64–encoded representation of the data in the XML stream.
  3. SQL Server Full Text Search (FTS) operations can be performed against columns that contain fixed or variable-length character (including Unicode) data. You can also perform FTS operations against formatted text-based data contained within image fields—for example, Microsoft Word or Microsoft Excel documents.
Disadvantages of Storing BLOB Data in the Database:
Carefully consider what resources might be better stored on the file system rather than in a database. Good examples are images that are typically referenced via HTTP HREF. This is because:
  1. Retrieving an image from a database incurs significant overhead compared to using the file system.
  2. Disk storage on database SANs is typically more expensive than storage on disks used in Web server farms. 
 Storing Image in a folder:
Storing Image in a folder and using URL or relative path in the database is the way I would recommend. They are having many advantages and here are some of them.
  1. Normally sql server space is more expensive than ordinary disk space in hosting environment.
  2. You can name images in a Search Engine optimized way
  3. Essay to manage, backup and restore images and database.
  4. More suitable for static pages, (if you optimize some pages for performance).

As per my opinion  storing images in the folder is more acceptable.

No comments: