2

I have a web application written in asp.net/c# I want to know which one (save image in database or on hard disk) has better performance, security and flexibility

Thank you

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
danarj
  • 1,798
  • 7
  • 26
  • 54
  • store link to path of image in database and store image on harddisk – Mudassir Hasan Apr 03 '13 at 07:24
  • save image in database ? why don't you perform a benchmark ? – Raptor Apr 03 '13 at 07:24
  • 2
    You might be interested in this paper by Micrsoft: http://research.microsoft.com/apps/pubs/default.aspx?id=64525 In a nutshell: depending on the (average) size of the binary data the database might be faster or the filesystem. –  Apr 03 '13 at 07:50
  • you check out the following articles [here][1] and [here][2]. [1]: http://stackoverflow.com/questions/1419546/sql-server-filestream-limitation [2]: http://stackoverflow.com/questions/8739188/pro-cons-of-storing-filespictures-in-a-sql-server-for-a-website – dferidarov Apr 03 '13 at 08:05

1 Answers1

5

One option to consider, if your version of SQL Server supports it, is FILESTREAM

FILESTREAM integrates the SQL Server Database Engine with an NTFS file system by storing varbinary(max) binary large object (BLOB) data as files on the file system. Transact-SQL statements can insert, update, query, search, and back up FILESTREAM data. Win32 file system interfaces provide streaming access to the data.

This lets you keep the files on disk, but maintains transactional consistency with other data that you're storing in the database.

Damien_The_Unbeliever
  • 234,701
  • 27
  • 340
  • 448