Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
After upgrade dbqueries increased!
Avatar
WilRC
Member
sp_UserOfflineSmall Offline
Sep 1, 2015 - 4:26 pm

This is doable no problem at all!

We don’t use a cache plugin.

Testresults:

1 at the time

Line 64: add_action('sph_setup_forum',    'sp_linking_check_delete_action');
Queries decreased 255 to 248

Line 120: add_action('sph_setup_forum',     'sp_linking_break_listen');
Queries decreased 255 to 247

Together: 255 to 245

Line 67:                add_filter('the_content',      'sp_linking_show_blog_link');
Queries decreased 255 to 245

Line 68:                add_filter('the excerpt',   'sp_linking_show_blog_link');
Queries decreased 255  to 247

Together: 255 to 255

Line 111: add_action('sph_blog_support_start',     'sp_linking_canonical_url', 1, 1);
Queries decreased  255 to 247

Line 112: add_filter('sph_aioseo_canonical_url',  'sp_linking_aioseo_caninical_url', 1, 2);
Queries decreased 255 to 248

Line 113: add_filter('sph_canonical_url',  'sp_linking_switch_canionical_url');
Queries decreased 255 to 247

None of these are resposible for the queryload!

I did some extra testing. Get comments number is suspicious!
Line 75:      add_filter('get_comments_number',  'sp_comments_count_filter', 1, 2);
Queries decreased from 255 to 160

Line 497:   remove_filter('get_comments_number', 'sp_comments_count_filter', 1);
Queries decreased 255 to 161

Together: 255 to 160

I think we've found the main culprit in the get_comment action and filter!?

KR,

Wil

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 1, 2015 - 9:05 pm

sorry, will have to wait for @yellow-swordfish to return in the am...

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 2, 2015 - 2:36 am

Ah... is that what the numbers are against each of the little extracts? Comment counts?

Seems like a pretty unique situation which is why, I guess, it hasn't come up before. Seems that probably the best solution would be to cache the data which would result in one read per post instead of multiple. Let me see what I can work out today and then I can ask you to change the code and test. OK?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 2, 2015 - 2:54 am

Let's try this. Same file as before but this time right down the very bottom is the function:

sp_blog_links_control()

On the line before the switch command at the top can you insert the line:

static $bLinks = array();

and then we will change the case 'read' code to be:

if(!array_key_exists($postid, $bLinks)) $bLinks[$postid] = spdb_table(SFLINKS, "post_id=$postid", 'row');
return $bLinks[$postid];
break;

and see if that helps out. I would be quite happy to make this part of the permanent code.

andy-signature.png
YELLOW
SWORDFISH
Avatar
WilRC
Member
sp_UserOfflineSmall Offline
Sep 2, 2015 - 12:51 pm

I have adjusted the code.

Works great. Queries decreased 255 to 162. Perfect solution.

Thanks for the support and service 🙂

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 2, 2015 - 12:59 pm

Good news. Consider that code as being in the next plugin update.

andy-signature.png
YELLOW
SWORDFISH
Avatar
WilRC
Member
sp_UserOfflineSmall Offline
Sep 2, 2015 - 4:09 pm

Sorry YS, we were cellebrating to soon. With the code adjustments the blog link disapeared on the article page. You have the option in the editor to add a blog link but it doesn't show up!

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 2, 2015 - 4:34 pm

Can you check the options in the admin, There is a possibility i turned it off and forgot to turn it on again. Plus the changes we made today would not have that effect

andy-signature.png
YELLOW
SWORDFISH
Avatar
WilRC
Member
sp_UserOfflineSmall Offline
Sep 3, 2015 - 2:22 pm

The blog link plugin is turned on. On the article page the Forumlink is disapeared. Undo the code changes will show up the forumlink again. There is a get_comments code in my themefunctionsfile, could that be responsible for the extra queryload on the frontpage together with the bloglinkfunction.

The get_comments is a part of the recentcomment widget!

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 3, 2015 - 4:33 pm

Bit we did nothing to stop the blog link showing up. All we did was cache the results so that ot did not perform more than 1 database query for each post ID.
What about the filter.action hooka at the top? They should ALL now be uncomnented and running. Are they?

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626