Yan Huang Reveals Striking Difference Between PHP Array vs MySQL Query Performance
Image: http://www.getnews.info/uploads/f164969128d875ed0604a0e132c89c98.jpg
27 May, 2015 – LOS ANGELES, CA — Yan Huang, a digital marketer based in Los Angeles, Calif., ran a series of page speed performance tests to ensure the website development approach used on a project he is working on scales properly and loads fast to create the best mobile and desktop user experience, which will affect the site’s Google SERP (search engine results page) rankings.
“In this specific case scenario, I have a database table of contacts with 26 columns and 100,000+ rows and I need to display the total number of contacts per unique company for each state in an HTML table. The first approach would be the easier approach of looping through each state and querying the total from the database, resulting in an output of 1 row per request across 50 requests. The second approach would be to load all 50 rows into a PHP array, resulting in an output of 50 rows per request across 1 request, and then looping through the array to search for the matching state, 50 times.”
Yan leveraged two development approaches, the PHP array approach and the MySQL query approach, to achieve the same output. The performance results were astonishing.
“The PHP array approach completely annihilated the MySQL query approach. Pingdom’s page speed test showed that the PHP array script executed in 1.28 seconds while the MySQL query script took 56.76 seconds to execute. Both approaches return the exact same resulting HTML,” said Yan on his blog, Yan 411, referencing to the initial run on his test case.
The full article is available on his blog:
http://yan411.com/php-array-vs-mysql-query-performance-test/
About Yan Huang
Yan Huang is an experienced entrepreneur and award winning web marketing director. He is founder of Press Release Jet, a paid press release distribution service that helps clients gain visibility through social media, organic search and local & national news outlet distribution. He is also a featured expert of email marketing services and web hosting reviews at Reviews.com. Yan has an extensive background in digital marketing including SEM, SEO, press release marketing and email marketing. He has founded several companies including Gray Hat Web, a web design, marketing and advertising business with clients tailored towards fashion boutiques, lifestyle and luxury brands, ContentWriters.us, which specializes in generating unique content for domainers, webmasters and SEO agencies, and ONE v8, a web design and web hosting business. Yan spent the beginning of his career as a web designer/developer, giving him a deep understand of web development. He has been panel speaker and speaker of numerous events including the Young Entrepreneurs Organization (YPO), Pasadena City College and the Southern California Domainers Group.
For more information, visit:
http://yan411.com
http://linkedin.com/in/yanshenghuang
Distributed by Press Release Jet
Media Contact
Company Name: Yan411.com
City: Los Angeles
State: California
Country: United States
Website: http://yan411.com
ReleaseID: 501512
Source: GetNews