The good and bad aspects of flat file storage

Posted on 23.12.2009 by Emil

I start to code php in 2001-2002 and at that time, mysql was not so very extended on servers in Romania. I start to build php applications with flat database, which is text file information storage known as CSV files. Excel support this type of file. After 6 years I'v seen good and bad things about this storage type.

The good things are:

  • you don't need connections with any kind of database.
  • you can easy implement your flat files structure.
  • you can easy import information from excel files.
  • you can edit with notepad your database flat files.
  • easy to add more information in files - append.

The bad things are:

  • size of files depends of php.ini settings. If you don't have access to server, you'll get error message like --- Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 68 bytes) in yourpage.php on line 18 --- and this cannot be fixed.
  • When you have a lot of information in the same file, is hard to edit online, if many peoples had to access at that file, I am talking here about update and delete information.
  • Not easy to update connection between flat tables.
  • Not easy to design big structure of data, even on diagrams looks like mysql tables structure.