Question

Photo of Jez Hailwood

0

What's the most appropriate storage type for a PDF?

I need to add a new file type for use with an extended attribute, but I'm not sure whether to choose FileSystem or Database as the storage type. If I chose FileSystem, where should I put the files?

  • Photo of David Leigh

    0

    This decision really depends on the expected size of your database and how you want to manage these files.

    For anything other than a small database, I would recommend file system storage for the following reasons:
    1. Reduced database size.
    This means better performance and your nightly database backup will run faster and take up less space.

    2. The PDF files can be backed up and managed separately.
    Given that these files are usually relatively static, they probably don't need to be backed up nightly - they can be backed up on a separate schedule.
    Also, it is easier to track large files and other potential problems if the files are stored in the file system.

    3. You have the option to store the files in a different location (a slower disk/server) if necessary, when resources on the database server become an issue at a later stage.
    Having said that, I would follow the pattern used for Rock Media Files until such time as you need to store files in a different location.

    Hope this helps.

    • Jez Hailwood

      So helpful, thanks! Would you recommend that I use ~/App_Data/Files as the root, or something like ~/App_Data/Files/MyNewFileType?

    • Jez Hailwood

      Thanks again. I don't suppose you know what happens if you change from database to file system storage when there are already files in the database?