As i see, MySQL stores all data in files as well. So what exactly is the thing that makes is fastet than flatfiles? Im in the process of making a flatfile site management tool,and going for flatfile(with caching options & ststic page generation possibility). What would the advantages be?
If you use MySql, it'll be easier to manage the data. If you use flat file, you have to define your own file format and write code to parse the file. The time it takes to load the file will increase as your file gets bigger and bigger. Database is more flexible and efficient in the long run.
I don't know if I would describe MySQL as storing data in files, becuase its storing them in a database... I guess thats the obvious note. Anyways, flat file never comes out on top IMO, unless your server doesn't support MySQL, or any other type of DB. As noted above, efficiency and flexibility but also its easier to use.
MySQL files do not contain just the data - also indexing and metadata. The indexing makes accesses fast. As for metadata - it can store access control lists (who can read from the DB, write to it, etc). Also typing - think about a column that contains entries like "20070123". Are they strings? Numbers? Dates? That's important when you want to, say, compare them or take averages. A full database has all of that information in the "files", the flat file won't.
Well,my idea of flatfile was this: Have the file(whatever.ext)and in there store IDs. So,each the structure would be: ID(number)|variable type|content Im still looking into this,since im not sure if the above example would work at all.
What method of reading and writing of the flat file are you thinking about? If it's sequential than you'll have read the file from the top to the the position of the data you are looking for. While a database take care all of that for you. As mention earlier in this thread, database take care of all the hard work for you, as such read and writing files and locating in the correct place without using you own search algorithm. I guess it also depends on what application you are writing. Are you writing something for web backend or a desktop application?
Embrance, what you just described is called a database row. Why do I get the feeling that you are not convinced that database is good and flat files are so 1995.
mysql is a Relational Database. It is not a files. its benefits include fast retrieval and the ability to do join query between different table. I would not go to flatfiles for storing permanent data. BUT flatfiles is good for daily batch file that may be used for transporting data from one system to another
Its much better to use mysql because if you use flatfiles you will need a file to store all the information. The more information the slower the site will be. - Prilep
Just wanted to add the MySQL server also handles locks etc (multiple users etc). Two visitors accessing the same flatfile at the same time (one might be updating another reading) will give you trouble
Thanks guys for your input on this: 1)I know the way i described it,is almost the same way a table looks. I have been working with SQL DBs for like 2 years now. 2)What i want to make is a very simple News script with an css file to control the look. The script will have some predefined variables,and will know where to get the data from already from the very beginning.Currently what i was thinking: store in each flatfle like 100 entries,no more-no less. Use a way to make folders and every 100 entires create a flatfile to hold the neext 100 nes items.Or i could just have only IDs in the flatfile and point to a static HTML wich will be generated using the news system. So the structure would be: ID|URLtoHTML| I think this will be easier though. Im not surre what type of method to use to access files,but i have been studying the way NavBoard works for some weeks now. You should check it out.Maybe the best script that uses FF,and actually works,lol.