|actual text file vs mysql database content, best performance|
actual text file vs mysql database content, best performance
| 5:16 am on May 30, 2011 (gmt 0)|
Which would perform faster?
A site that uses includes to include text files with html content
A site that uses a mysql database to store html content and display when query'd?
(basically questioning if including static text is faster than mysql query)
Also, 2nd question, which would be faster
Site that stores information in XML and on the front end users can search site data, and the site uses php to parse the XML and output results.
Site that stores information in mysql database and and on the front end users can search site data, and the site uses php to query the mysql db and output results.
| 1:48 pm on May 30, 2011 (gmt 0)|
In my own opinion and experience a MySQL query will be best for each case.
I manage a site that use to have over 1.5 million HTML pages and I created a PHP script that clean up the HTML like remove navigation and CSS and the import it into a DB. I saw benefits in managing the site and performance was not affected (I run the site in a dedicated server)
| 6:10 pm on Jun 2, 2011 (gmt 0)|
There isn't really the one correct answer to this. Very often (more often than not, actually) Apache can grab a file of a reasonable size and show it to a user faster than MySQL would locate the record, build the file and THEN Apache will show it to a user. If your content never-ever changes and your template is small compared to content, you might as well just stay with static files for speed.
| 6:52 pm on Jun 2, 2011 (gmt 0)|
The answer depends on the how intense the usage of the data is.
If you are simply grabbing all the data and dumping it to screen or something like that then flat files can be faster... however as soon as you want to start "querying" the data... as in grabbing 1 record out of 1000s, or if you are going to be using any aggregating functions like, AVG(), MIN(), MAX() or if you are going to be making use of dates then a database is the way to go as all this is built in.
When you are dealing with flat files you are dealing with strings, when you have the data in a database you can assign datatypes like boolean, date, integer which can be very useful
| 7:02 pm on Jun 2, 2011 (gmt 0)|
Static text, assuming it's just opening a file in the OS and dumping it, in theory should always be faster unless your directory has thousands of files in it. The file open process is the hit here, you need to keep the number of files in a directory low as that's where it burns time.
Next, text files never crash, MySQL does. I run a directory and auto-scan for broken sites all the time and I see a lot of dead sites with some error about a failed table or can't connect to the database.
No real right or wrong answer, decide what's best for you.