PDA

View Full Version : Databases, and how they work



Lurker
08-14-2003, 08:23 PM
How exactly do Databases (MySQL, SQL, Access, ect.) work? I haven't seen them specifically create files to store the info, and I don't know how else they would work, as variables within the program itself would be deleted after the program is closed. Especially MySQL, how does PHP connect to it, write to it, and save it without files? Thanks all :D .

adrianxw
08-14-2003, 09:23 PM
They do use files. Why do you think they don't?

vasanth
08-14-2003, 10:22 PM
Originally posted by Lurker
How exactly do Databases (MySQL, SQL, Access, ect.) work? I haven't seen them specifically create files to store the info, and I don't know how else they would work, as variables within the program itself would be deleted after the program is closed. Especially MySQL, how does PHP connect to it, write to it, and save it without files? Thanks all :D .

they do use flat files when it comes to storage.. but they have a middle layer which takes care of this. When you start the database the database will load the index and other information into the memory.. all your query is searched through the indexes and when a result is found a pointer will point to the actual record on the hard disk... they use data structs called b-trees to index the records to make searches faster.. Basically the records are stored on the hard disk..