   ASP.NET - Which is faster of the two sol...
  Hey, I came to thinking, System I/O can be slow if done in large volume and can create overhead. At the same time I was wondering, which would be faster:Scanning through a directory for every image file in it or scanning through a SQL Database for all the image records? I'm thinking the SQL solution would befaster but I could be wrong.   
  Scanning through an SQL table to get the locations of all the image files on a hard drive. You should never be storing images in a database IMO.   ;Quote:Original post by MachairaScanning through an SQL table to get the locations of all the image files on a hard drive. You should never be storing images in a database IMO.Not true. If you are performing heavy spatial analysis on those images, it is often advantageous to store it in the database. Of course, you will need to be using a database specifically meant for spatial analysis, such as Oracle 10g Spatial or ArcGIS Server on top of Oracle, in order to get any of that benefit.But anyway, the OP needs to define "large". When I think of "large," I think of several terabytes of high-resolution imagery. At this level, the database offers caching and hashing abilities that greatly enhance performance over hard drive access.Of course, if you're bad at SQL, all bets are off.   ;  I can't tell you which approach is faster - you'll need to benchmark them.In any case, there might be a good reason for using the slower one.Almost certainly the OP is trying to do premature optimisation.I think that storing (lots of smallish) images in a database is extremely good - my argument is purely based on management - it's a lot easier to manage all your data in the same place (i.e. a database) than having it spread around.As long as you don't do anything silly, loading images from a database should be efficient.Having the database server on the same physical machine as the web server is a major win and should be done if at all possible. Some architectures may mean that you can have a cluster of machines being both the database and the web app. I don't know how to do this with MSSQL server (as far as I know, it doesn't support that kind of clustering, but maybe?)Mark   