Is there any advantage in using a file to store a long piece of text (say, a lengthy blog article), over a MySQL TEXT-type field? In my mind, I would imagine having retrieving the file through your program (PHP) being much quicker than bothering MySQL with fetching it for you.
Share
I’d say there are advantages either way, and it’s just up to your specific situation. For example:
Using a text database field means that your blog entries are all contained in your database, making it easier to back up and move. It also means that you will not have to worry about file access, things like security, file locks, file names, etc. Also, you can query the data without writing any special code.
Using files instead also has benefits. It keeps your database small, especially when dealing with a lot of files. It allows the data to be accessed easily by other people, programs or machines with no database access. And you can easily transfer the files to another location if you need to reorganize your disks.
So it’s totally up to your environment. Personally, unless you’re dealing with a huge number of files, or huge files, I’d probably stick with the database option. It’s just easier to deal with in most cases.