File system or Database?

Discussion in 'vBulletin Discussions' started by John, Jul 23, 2009.

  1. John

    John Regular Member

    Joined:
    May 23, 2009
    Messages:
    757
    Likes Received:
    87
    Location:
    Tennessee
    What is the difference on storing custom images and attachments in the database and the filesystem?
    Is something of thoose better then the other? Why?
     
  2. David

    David Regular Member

    Joined:
    May 30, 2003
    Messages:
    1,088
    Likes Received:
    133
    Location:
    Australia
    always use the filesystem when you can. Its quicker and more efficient and will keep your site running smooth and your database size to a minimum
     
  3. John

    John Regular Member

    Joined:
    May 23, 2009
    Messages:
    757
    Likes Received:
    87
    Location:
    Tennessee
    But why is it important to keep you database size to an minimum?
     
  4. David

    David Regular Member

    Joined:
    May 30, 2003
    Messages:
    1,088
    Likes Received:
    133
    Location:
    Australia
    lots of reasons, mainly because file system is faster
     
  5. torque

    torque Regular Member

    Joined:
    Jun 7, 2009
    Messages:
    736
    Likes Received:
    12
    Location:
    Campbelltown, New South Wales, Australia
    hahaha thanks for that I never knew the difference and this answered the question for me!
     
  6. Wayne Luke

    Wayne Luke Regular Member

    Joined:
    Apr 2, 2009
    Messages:
    992
    Likes Received:
    276
    There are pros and cons to both methods.

    Database storage-

    • Management is easier especially when creating backups or moving servers. Everything is one place.
    • Works out of the box in a multi-server environment
    • Many shared hosting providers use open_basedir and other security measures which prevent vBulletin from storing attachments and other uploads to the file system.
    • Its main disadvantage is that storing binary files in the database can lead to corruption if you change the database encoding.
    • Database size will also be large however as queries are indexed speeds shouldn't be slower with proper hardware.
    File Storage

    • Lower file size of the database files. Though the database is still necessary and used to retrieve information about the attachments before loading.
    • Somewhat easier lookup though the OS will maintain its own database for file location on the disk. This can be faster but is not necessarily so.
    • Can be managed through the file system including anti-virus scanning.
    • Can be stored outside the webroot (can't do this with avatars and profile pictures though).
    • Harder to manage. Files are stored in multiple directories that belong to the webserver, not the user. Permission management can be a big issue.
    • Difficult to maintain if you use multiple web and database servers.
    • More difficult to move servers.
    That being said, if your hosting provider allows it, than you should use File System Storage. The benefits outweigh the consequences.
     
  7. Nick

    Nick Regular Member

    Joined:
    Jul 27, 2008
    Messages:
    7,444
    Likes Received:
    219
    I always use the file system so I can keep as much out of the database as possible.
     
  8. Soliloquy

    Soliloquy Regular Member

    Joined:
    Jun 3, 2009
    Messages:
    2,402
    Likes Received:
    66
    Location:
    New York City
    I use the file system because it's easier to back up a small database.
     
  9. Wayne Luke

    Wayne Luke Regular Member

    Joined:
    Apr 2, 2009
    Messages:
    992
    Likes Received:
    276
    Do you backup the file structure every time you do? Because you should.
     
  10. David

    David Regular Member

    Joined:
    May 30, 2003
    Messages:
    1,088
    Likes Received:
    133
    Location:
    Australia
    I don't I'm pretty lazy with the filesystem back ups since I hardly get any attachments posted i generally do them once or twice a week where as the DB I backup daily
     
  11. kev

    kev Regular Member

    Joined:
    Mar 9, 2009
    Messages:
    1,224
    Likes Received:
    61
    I use the file system - my database is already 800 megs - 1 gig. With several thousand attachments, I wonder how many gigs the database would be if all of those files were stored in it.
     

Share This Page