Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use MySQL over flatfiles?

A friend and I were debating about whether he should use MySQL or a flatfile database for his website's backend. I told him to go with MySQL because it was structured, held records well, and was consistent. He on the other hand said that he would rather go for speed. Reading files is a lot quicker than connecting to MySQL and it made me wonder whether he was right. For example, why not just create a folder for each table, like so: users/ groups/ posts/, within the folders have the files named by ID (1, 2, 3) and then for the data use a format like so: username: John\npassword: e2fc714c4727ee9395f324cd2e7f331f\nemail: [email protected]?

In other words, what are the advantages of MySQL over flatfiles?

like image 441
John M. Avatar asked Apr 19 '10 13:04

John M.


People also ask

Why use a database over a flat file?

Database provide more flexibility whereas flat file provide less flexibility. Database system provide data consistency whereas flat file can not provide data consistency. Database is more secure over flat files. Database support DML and DDL whereas flat files can not support these.

Why are relational databases better than flat files?

A relational database is one that contains multiple tables of data that relate to each other through special key fields. Relational databases are far more flexible (though harder to design and maintain) than what are known as flat file databases, which contain a single table of data.

What are the disadvantages of using a flat file database?

Disadvantages of flat-file database Flat file database is harder to update. Harder to change data format. It is poor database in terms of complex queries. It increased Redundancy and inconsistency.

Why is scalability An advantage of databases over flat files?

Scalability. Relational databases are scalable, meaning they can grow larger or smaller as needed and be accessed by more users when necessary.


1 Answers

In other words, what are the advantages of MySQL over flatfiles?

MySQL offers indexes and joins (for execution performance), transactions (for data integrity) and SQL (for development performance).

It your project involves just a 3-line self-sufficient text file, you don't need MySQL.

like image 135
Quassnoi Avatar answered Sep 27 '22 20:09

Quassnoi