I am really familiar working with flat file databases, and have only created a few SQL db's (more for testing than anything). However, a new project I am working on has got me seriously considering to use mySQL? Scalability of course is my major concern, and although flat file db's have worked for me pretty good, I'm concerned if this new project ends up growing to a point where a flat file solution would break.
A few questions for those who are more knowledgable than I am on this topic... I hope you don't mind.
I realize coding has a lot to do with the efficiency of our programs, and also the way we set-up our databases flat or for mySQL. I do my best to think ahead before I code so, I'm looking at the worst case scenario, and I'm struggling to decide which one to use when your DB becomes it's own little monster. How efficient is mySQL anyway for huge amounts of information? I'm thinking it's better than flat files for sure, but reading the thread I entered above, seems some disagree. I'd really love to hear some pros and cons about that :)
In terms of your category question, you have to determine if one entry can have multiple categories. If it is a 1:1 mapping, the post above is what you want. If it is a 1:N mapping, you'll need a third table to link the items to the multiple categories.
Search the web for "third normal form", you'll find information on how to design a table.
Sean
I ask because I'm used to linking my text files together and placing let's say my info for CatA in cata.txt and CatB in catb.txt so that each file does not accumlate so much (insignificant) data that it becomes unstable. I've produced some pretty big files this way, and my code still spits out my data in record speed. However in mySQL is this type of "thinking" necessary?
I've seen examples where some just place all their "data info" into one main table.. and I guess that's where my question orginates from.. it's a totally different way than I'm used to thinking in terms of "structure", because I'm always thinking, how to best avoid overloading my text files :)
> The nice thing about using a database is that you don't have to worry about locking and concurrency
So, unlike text files, with mySQL you don't think that I should worry too much about using the LOCK feature? I just learned of LOCKing in mySQL and was not using it at all in my testing, and since I lock so often.. I thought Oh oh ..
Thanks very much! I believe I'm going to go with mySQL as my database this time around.
SQL servers build indexes (well, you tell them to) to cut down on seek times within a large table. In a relational database, like data items go in the same table, ie if you have three categories, they all go in the same table with an identifier to specify the category.
A word of caution:
I, like you, started out in flat files before moving into databases. I learned the hard way that a database is *not* a flat file, ie the techniques you use to design the flat files are different from databases. Bad table layout also makes the project harder, so it's worth it to do a bit of reading.
Sean
Thanks again.