Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme »

SQL queries for option parameters

Build custom WP THEMES, without
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
Old Jun 7, 2009, 04:10 PM
5 posts · Jun 2009

I noticed a strange behavior in atahualpa 3.3.3 (I don't know if it is the same in previous versions). If I reset the setting I get 250 queries (statistics in footer) for bfa_ata_ option values. Every setting saved in theme settings reduces the number of queries. The queries, called by are like "SELECT option_value FROM wp_options WHERE option_name = 'bfa_ata_cat_noindex' LIMIT 1" and they return no values.
These calls are unnecessary and should not be called by the theme scripts.

Best regards, Domen
Old Jun 10, 2009, 08:35 AM
Flynn's Avatar
3,768 posts · Oct 2008
Munich, Germany
The number of queries - as per the measurement of Wordpress - looks high because for each option it checks whether it is saved in the database, and if not, the default value is being used. As you have noticed, saving options reduces the amount of queries (even though the amount of table rows increases), but it does not reduce the overall rendering time of a page. In other words, is Atahualpa slow for you, or, does saving the options (and reducing the amount of queries - as counted by Wordpress) improve the rendering speed by more than a few 1/100 seconds?
Old Jun 10, 2009, 01:52 PM
5 posts · Jun 2009
I think it saved me between 100 and 300 ms.
I just added a sentece in bfa_get_options.php, that writes a option into database if it is not found inside it.
Now I get this statistics at the footer: 39 queries. 0.523 seconds. But a sum of time of all executed queries takes about 150 ms (http://codex.wordpress.org/Editing_wp-config.php). Maby it's connectiong to database ...
Old Jun 10, 2009, 02:25 PM
5 posts · Jun 2009
OK ... 0.532 seconds is total rendering time.
Old Jun 11, 2009, 02:10 PM
Flynn's Avatar
3,768 posts · Oct 2008
Munich, Germany
For me the difference between no options saved (116 ms) and all options saved (109 ms) is 7 ms. Reset all settings and check the rendering time, then save all settings and do the same, then compare the difference. How many ms difference do you get?

My example is on a fast server, with XCache, with Atahualpa 3.3.4, no plugins activated, a few dozen posts, a few hundred comments, measuring the homepage with 10 posts
Old Jan 20, 2010, 11:58 AM
5 posts · Jun 2009
Hi, sorry for a little late answer.

I made a little fix in bfa_get_options.php.
Line 15:
if (get_option( $value['id'] ) === FALSE)
$$value['id'] = $value['std'];
$$value['id'] = get_option( $value['id'] );
Is replaced with:
if (get_option( $value['id'] ) === FALSE) {
$$value['id'] = $value['std'];
update_option($value['id'], $value['std']);
$$value['id'] = get_option( $value['id'] );
So that every option gets written into the database. It helps speed up my slow (Sempron) server.


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding login/logout menu option. soop Atahualpa 3 Wordpress theme 12 Sep 12, 2011 01:01 PM
Number of Queries and CPU Usage getting worse with each version extremecarver New Versions, & Updating 20 May 5, 2010 09:12 AM
Debug Queries js9600 Plugins & Atahualpa 0 Apr 23, 2009 08:25 PM
Excerpt option doesnt work Question Excerpts, Read more, Pagination 1 Mar 17, 2009 10:20 AM
[SOLVED] Very minor : page menu bar home option dcousquer Page & Category Menu Bars 1 Dec 13, 2008 03:52 AM

All times are GMT -6. The time now is 11:50 PM.

Powered by vBulletin® Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.