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

前端 未结 4 953
北荒
北荒 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:20

    Pro: highly portable.

    Con: you can't do anything with it using SQL (indexing, searching, etc) and you'll need to add metadata in other columns (content type, filename, etc) to improve (re)usability and maintainability.

    I wouldn't do that. The disk file system is much better suited system for those tasks.

提交回复
热议问题