homepage Welcome to WebmasterWorld Guest from 54.196.63.93
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
actual text file vs mysql database content, best performance
actual text file vs mysql database content, best performance
drooh

5+ Year Member



 
Msg#: 4319467 posted 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

OR

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.

OR

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.

 

redhatlab

5+ Year Member



 
Msg#: 4319467 posted 1:48 pm on May 30, 2011 (gmt 0)

Hi,

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)

1script

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4319467 posted 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.

Demaestro

WebmasterWorld Senior Member demaestro us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4319467 posted 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

incrediBILL

WebmasterWorld Administrator incredibill us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4319467 posted 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved