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

前端 未结 4 954
北荒
北荒 2020-12-20 19:54

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, d

4条回答
  •  粉色の甜心
    2020-12-20 20:13

    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.

提交回复
热议问题