Jump to content

Recommended Posts

Is it okay to not use MySql and just use flat file databases to power a user management thing? I don't have any problems using flat file databases and I was just wondering if there are any major disadvantages. Do all large sites use MySql databases and is there actually any large site that uses flat files?

Link to comment
https://forums.phpfreaks.com/topic/53005-solved-using-flat-file-databases/
Share on other sites

To be honest, I've never heard of any site over a thousand people using flat file.

 

With flat files, you must load/read the entire file.... If the file grows to 10MB what are you going to do if you start getting substantial amounts of hits?  (At 10MB it doesn't take many hits ;p)

But is there any extremely large disadvantages? If a MySql database has a lot of information, won't it load slowly as well?

 

Not necessarily. If you use a RDMS, and you only need to call rows with a certain condition (like this)

 

mysql_query("SELECT * FROM mytable WHERE myfield = 'something'");

 

and if it returns, say, 3 rows - that will take no time at all. However, when using a flat file, you'd need to load the whole file first before calling whatever information. Plus, it is extremely easy to work with MySQL in PHP.

One of many important things that an RDBMS like MySQL provides is the use of indexes.  As the data stored in a flat file grows the time it takes to search for things in that file will increase linearly.  That is, if it takes 1 second to search for a record when the file has 1000 lines it will take 10 seconds to search for that same record when the file contains 10000 records.  Using indexes, time will increase logarithmically with respect to the number of records.

 

Best,

 

Patrick

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.