Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   SQL queries for option parameters (http://forum.bytesforall.com/showthread.php?t=1967)

gejba Jun 7, 2009 04:10 PM

SQL queries for option parameters
 
Hi,

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

Flynn Jun 10, 2009 08:35 AM

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?

gejba Jun 10, 2009 01:52 PM

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 ...

gejba Jun 10, 2009 02:25 PM

OK ... 0.532 seconds is total rendering time.

Flynn Jun 11, 2009 02:10 PM

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

gejba Jan 20, 2010 11:58 AM

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'];
else
$$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']);
}
else
$$value['id'] = get_option( $value['id'] );
So that every option gets written into the database. It helps speed up my slow (Sempron) server.


All times are GMT -6. The time now is 01:08 PM.

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