Elliott C. Back: Internet & Technology

Wordpress SQL Efficiency

Posted in Blogging, Code by Elliott Back on March 29th, 2005.

It turns out that Wordpress 1.5 isn’t as efficient on your SQL server as you’d hope. In a message to the wordpress-hackers mailing list, Sencer writes:

I am trying out WP1.5 and looking at the query-log of mysql for a page-request that only displays a list of 10 entries. Some queries are identical/duplicates, so the code could be easily rewritten to drop these queries. This is only a suggestion. Maybe one of the devs that is familiar with the WP codebase wants to look into this.

Here is a list of the queries as they are made during execution: www.sencer.de/code/wp/qlog.txt And here is a sorted list: www.sencer.de/code/wp/qsort.txt

If you look at his findings, there are almost two dozen calls to the wp_users table that could be rolled into one query, as well as some 100% duplicate queries. Probably the best solution would be to wrap everything in a query cache, and optimize the code which queries the users table. As a developer, always remember to profile production code, especially web code!

This entry was posted on Tuesday, March 29th, 2005 at 4:18 pm and is tagged with qlog, sencer, query log, qsort, web code, wp1, page request, codebase, devs, best solution, sql server, queries, hackers, execution, efficiency, wp, suggestion. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.

Leave a Reply

Powered by WP Hashcash