File system or Database?

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

  1. John

    John Regular Member

    757
    87
    394
    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

    1,088
    133
    518
    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

    757
    87
    394
    But why is it important to keep you database size to an minimum?
     
  4. David

    David Regular Member

    1,088
    133
    518
    lots of reasons, mainly because file system is faster
     
  5. torque

    torque Regular Member

    735
    12
    104
    hahaha thanks for that I never knew the difference and this answered the question for me!
     
  6. Wayne Luke

    Wayne Luke Regular Member

    991
    276
    202
    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

    7,441
    218
    458
    I always use the file system so I can keep as much out of the database as possible.
     
  8. Soliloquy

    Soliloquy Regular Member

    2,402
    66
    494
    I use the file system because it's easier to back up a small database.
     
  9. Wayne Luke

    Wayne Luke Regular Member

    991
    276
    202
    Do you backup the file structure every time you do? Because you should.
     
  10. David

    David Regular Member

    1,088
    133
    518
    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

    1,224
    61
    434
    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