Forum Moderators: coopster
the thing is there are a lot of variables that affect the scenario so there really isn't a definitive answer.
I think it would be close but I think the filesystem would be quicker as long as you are not searching through the files. As soon as you have to search I think the db would be faster.
Is the database running on the local machine? How much memory does it have? Is it a query which gets run often?
If the database is local (or on a machine close to the webserver), not heavily loaded, and it's a query or table which has been accessed before, then you stand a good chance of the information you're after already being in memory, which will make the access very quick.
Reading files off disk will always be slower than reading information out of memory.
Thanks a lot for everybody who shared these informations with us...
I did tested it now and the result was good for the Cache!
i reloded the page 20 times with cache and 20 times with SQL so here is the average microseconds:
0.0044372 with Cache (it once went up to 0.006196)
0.0052821 with SQL (it once went up to 0.012971)
But there are few things i am thinking of since the site is not heavy loaded yet, i am planning to advertise in radio next month so i should be ready for the traffic!
I ve VPS with RAM 512
So the thing is, what will happen when the cache folder gets like few thousands of files? will it get slower to find the file needed to display? (I know i can empty it whenever with a cron)
And what if it got slower, will it be slower than SQL when the database get also hundered thousands more records?
So, i dono, i just think that the result can change when the site gets bigger!
When it gets bigger, then i am planning to move to dedicated server and hopefully harddisk 10k or 15k... but i have never experienced with any fast harddisk...
Does they really boost up things? hope u share any info about this!
Thanks for you all...