Reputation: 21
I am converting large 3d files (up to 50Mb) into JSON data for display on a web page. This data would occupy a single database field in MYSQL. There is no scaling, just plain text to be stored. I was wondering what would be more efficient; storing the data in large text files or in a MySQL database field?
Upvotes: 1
Views: 899
Reputation: 108696
How many of these files do you have? How hard are they to manage (that is, how many new ones do you get per day, and how many do you render obsolete or delete each day)? How many different servers will you use to deliver this content to your audience?
You need the answers to those questions to justify your use of MySQL.
If you have only a few thousand or less of these files, and they're pretty much static, you should treat them like media assets -- like JPEG or MP3 files. Store them in and deliver them from a file system. Only if you have zillions upon zillions of them, and they change all the time, and you have to deliver them to your audience from dozens of servers, should you put them in MySQL. And maybe not even then.
Here's why: You'll have an extra network hop if they're in MySQL. Your web app will have to do a MySQL query, then read the response, then deliver the stuff to your audience. This is (a) complex, and (b) causes latency (response time) to increase a bit. Web servers are good at delivering files to your audience as data streams, and they do it very efficiently.
Here's another reason. MySQL assets are hard to put into a content delivery network if your audience scales up.
File system. All the way!
Upvotes: 1