Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the pros and cons of storing files in a database?

I'm writing a php application and was wondering if it's a bad idea to store complete files in the database. Files should be around 100-200kb mostly text files (txt, doc, docx and so on) or small image files. Or is it just a plain wrong idea?

like image 309
Gabriel Avatar asked Mar 16 '10 22:03

Gabriel


1 Answers

It really depends on the situation?

  • How the files going to be distributed?
  • Are the files used standalone or are they part of an system which might have its own authorization and authentication logic?
  • Whats your backup strategy?
  • Do you need replication?
  • Do you need to support a lot of I/O?
  • What about caching?

Having said that, I would lean toward some kind of filesystem for documents over a database.

like image 128
BeWarned Avatar answered Sep 30 '22 13:09

BeWarned