Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2010
    Posts
    3

    Unanswered: Storing filenames of images in db vs actual image

    Hi all,

    Which is better for performance? Storing an entire image in a database BLOB field? Or simply storing the file path?

    Here is the main use case: I am coding a database for a doctor's office. When a new patient comes to the front desk, they will type in the patient's name and it will show their last record, which is a scanned piece of paper.

    Am I better to store a path to the image, and just load it via IMG SRC or should I store the entire image, then save it to a temp file then load it with IMG SRC?

    Thanks

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    There are a lot of factors that go into making this kind of decision. You can go either way, but the vast majority of successful applications seem to store the URL or UNC for the file instead of storing the image as a BLOB.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Oct 2010
    Posts
    3
    Thanks for the quick response Pat.

    While this might be out of the scope of this question, I'll ask anyway: What kind of practice is used for storing the files in terms of their heirarchey? For example, would storing them all in a single directory (e.g. the "ScannedImages" directory) present any problems as far as file retrieval goes?

  4. #4
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    It also depends on the (average) size of the images.

    This document might be interesting for you:

    To BLOB or Not To BLOB: Large Object Storage in a Database or a Filesystem - Microsoft Research

  5. #5
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    I would store the file name and path less data space it what I have done

  6. #6
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    could look at FILESTREAM type in SQL 2008 also

    http://msdn.microsoft.com/en-us/libr...(SQL.100).aspx

  7. #7
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    Quote Originally Posted by dbguyjr View Post
    What kind of practice is used for storing the files in terms of their heirarchey? For example, would storing them all in a single directory (e.g. the "ScannedImages" directory) present any problems as far as file retrieval goes?
    windows (in particular the windows shell) has real trouble with folders that have many files in them. if you are going to have millions of images, don't put them all in the same folder.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •