The nice thing about having files in the database is that you can have constraints set up to keep files from being orphaned. For example, let's imagine we were implementing sourceforge, in perl and postgres. Sourceforge needs to deal with a lot of files, with projects and files being created and deleted all the time. If everything's in the database, if you delete a project, you can set things up so that a cascaded delete will remove all the files from the database at the same time, and you can tell, with a simple query, if you don't do that, which files are orphaned. Moreover, your database backups, if done right (check the pg_dump manpage), will include the appropriate version of all the files in there, so you'll never need to worry about them getting out of sync with your regular backups. Finally, you don't need to worry about a separate access path to manage the files referenced in your database -- if you can SQL in, you can upload/update/delete the files (subject to database ACLs, of course), and there's no need to also allow ssh, ftp, or whatever other solutions to manage this stuff. In sum, it's easier to get all the smarts that your database has to cover files if the files are in the database.

In reply to Keep your files in the database! by Improv
in thread compressing text by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.