GilesGuthrie
Staff Emeritus
- 11,038
- Edinburgh, UK
- CMDRTheDarkLord
This comes from work that Pako and I are doing on the same code blocks for independent projects.
Both of us have a requirement to take files from users, and store them within our web sites for later retrieval. We're both using PHP and MySQL, server DB space and disk space are not a problem for us at the moment, but as usual, we're concerned about the future scaling implications of decisions that we take now...
The core question is:
Is it better to take the file and store it inside a database as BLOB data, or is it better to copy the file to the web server's filesystem, and store pointers to that file in the database?
The arguments for BLOB storage are:
- ease of addition
- ease of retrieval
- no need to worry about filenames
- no need to worry about directory access permissions
The arguments for filesystem storage are:
- Performance scales better
- No dedicated code required to send file to browser
- Large amounts of files will not affect total database size
Now, before everyone jumps down my throat, I know that both of these sets of advantages can be worked around, but I'm looking to get a handle on what people feel is the best way of going about this. I'd especially like to hear from people who are running databases with large amounts of BLOB data, and/or people who are using the filesystem storage model, and how that affects things such as backup.
This is your mission for the day!
Both of us have a requirement to take files from users, and store them within our web sites for later retrieval. We're both using PHP and MySQL, server DB space and disk space are not a problem for us at the moment, but as usual, we're concerned about the future scaling implications of decisions that we take now...
The core question is:
Is it better to take the file and store it inside a database as BLOB data, or is it better to copy the file to the web server's filesystem, and store pointers to that file in the database?
The arguments for BLOB storage are:
- ease of addition
- ease of retrieval
- no need to worry about filenames
- no need to worry about directory access permissions
The arguments for filesystem storage are:
- Performance scales better
- No dedicated code required to send file to browser
- Large amounts of files will not affect total database size
Now, before everyone jumps down my throat, I know that both of these sets of advantages can be worked around, but I'm looking to get a handle on what people feel is the best way of going about this. I'd especially like to hear from people who are running databases with large amounts of BLOB data, and/or people who are using the filesystem storage model, and how that affects things such as backup.
This is your mission for the day!