patternsqlMajor
What's better/faster? MySql or FileSystem?
Viewed 0 times
whatbetterfastermysqlfilesystem
Problem
Let's imagine a web site that is a directory of people. For each person there may be a profile photo and a biography.
I'll admit my SQL queries could be better but in general what would be faster and use less processing power.
To check if a file exists and then open it
or
check against MySql to see if a bio exists and display it.
I'm pretty sure in the above case the filesystem will smoke the mysql database.
What if I make the database a read only delimited txt file?
What's faster in this case?
Is there a certain point where if the txt file has too many records it's better to use MySql?
I'll admit my SQL queries could be better but in general what would be faster and use less processing power.
To check if a file exists and then open it
or
check against MySql to see if a bio exists and display it.
I'm pretty sure in the above case the filesystem will smoke the mysql database.
What if I make the database a read only delimited txt file?
What's faster in this case?
Is there a certain point where if the txt file has too many records it's better to use MySql?
Solution
The file system is useful if you are looking for a particular file, as operating systems maintain a sort of index. However, the contents of a txt file won't be indexed, which is one of the main advantages of a database. Another is understanding the relational model, so that data doesn't need to be repeated over and over. Another is understanding types. If you have a txt file, you'll need to parse numbers, dates, etc.
So - the file system might work for you in some cases, but certainly not all.
So - the file system might work for you in some cases, but certainly not all.
Context
StackExchange Database Administrators Q#23124, answer score: 20
Revisions (0)
No revisions yet.