title: Saving attachments to database: blob vs path reference
body: <p>I am in a process of designing a system where one can create an entry and then add attachments to that entry, which is then saved into a database.  However I am of two minds on how to implement the attachment handling.</p>
  
  <p>I am battling between two approaches:</p>
  
  <ol>
  <li>Save the attachments to the database directly as blob field type</li>
  <li>Save to the database the directory path into the file and save the actual file to the server</li>
  </ol>
  
  <p>Now as far as I can see both of these approaches has pros and cons.  </p>
  
  <p>1st approach would keep all the data in the same place so I can easily move it elsewhere if I want to.  Also it keeps things consistent as far as "where is the data" guestion is concerned.  On the other hand I have heard that saving things like that is very resource hog and the database size will grow extensively.</p>
  
  <p>2nd approach would allow the database to keep to the easily managed data fields like text and numbers while the more heavier stuff is on the server.  This would also allow a more direct access to files if necessary.  On the other hand the data is seperated and more difficult to keep track of and would also need to introduce file system access in order to retrieve the said files.</p>
  
  <p>I am leaning towards the number 1 approach but to this end I am hoping an answer to the following:</p>
  
  <blockquote>
    <p>How would saving attachments directly to database impact on the database size and
    application performance?</p>
  </blockquote>