Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-17-2003, 03:42 AM
Xelation's Avatar
Xelation Xelation is offline
 
Join Date: Jan 2002
Location: Buffalo, New York
Posts: 457
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 50 queries and counting, please help!

Ok, I'm working on localhost here and Im trying to reduce queries... Ive installed xenons forum home optimizing hack.. now ive come to the showthread and there are far to many queries and I must reduce them... can anyone hlep me out?

Lesanes awards hack is causing the most damage and was wondering if anyone can help me fix that without getting rid of the awards hack?

see next post for query report....
Reply With Quote
  #2  
Old 07-17-2003, 03:42 AM
Xelation's Avatar
Xelation Xelation is offline
 
Join Date: Jan 2002
Location: Buffalo, New York
Posts: 457
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Fixed see new report below
Reply With Quote
  #3  
Old 07-17-2003, 04:31 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Add these to your showthread.php

$templatesused="";

(you may have to add it to both showthread and postbit sections)

,unregged,vbcode_smiliebit,vbcode_smilies,showthre ad_replybox,yesterday,awards

That's 6 queries down.

To go down more, you will have to uninstall the Awards hack, which is creating a loop, and giving you 1 query per post per thread.
Reply With Quote
  #4  
Old 07-17-2003, 04:36 AM
Xelation's Avatar
Xelation Xelation is offline
 
Join Date: Jan 2002
Location: Buffalo, New York
Posts: 457
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 01:31 AM Erwin said this in Post #3
Add these to your showthread.php

$templatesused="";

(you may have to add it to both showthread and postbit sections)

,unregged,vbcode_smiliebit,vbcode_smilies,showthre ad_replybox,yesterday,awards

That's 6 queries down.

To go down more, you will have to uninstall the Awards hack, which is creating a loop, and giving you 1 query per post per thread.
Thanks it worked, any other things that could help? is it possible to somehow alter the awards hack to not loop like that?
Reply With Quote
  #5  
Old 07-17-2003, 04:39 AM
Xelation's Avatar
Xelation Xelation is offline
 
Join Date: Jan 2002
Location: Buffalo, New York
Posts: 457
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Fixed, Updated Post Below
Reply With Quote
  #6  
Old 07-17-2003, 04:46 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Add "today" to templatesused too.

Sorry, you would have to recode the Awards hack so that it doesn't loop like that. I would use an alternative - just use custom profile fields for awards - they use up no queries, are easy to set up, and easy to modify and customize.
Reply With Quote
  #7  
Old 07-17-2003, 04:48 AM
Xelation's Avatar
Xelation Xelation is offline
 
Join Date: Jan 2002
Location: Buffalo, New York
Posts: 457
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 01:46 AM Erwin said this in Post #6
Sorry, you would have to recode the Awards hack so that it doesn't loop like that. I would use an alternative - just use custom profile fields for awards - they use up no queries, are easy to set up, and easy to modify and customize.
What would I have to do for hte profile feild thing?
Reply With Quote
  #8  
Old 07-17-2003, 04:54 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Make new custom profile fields, make them not editable by user, not viewable by member in profile.

Using your mouse, hover over the edit link, and remember the profield id of each of them.

Then, go to Admin CP, User, and to the user you want to give award to, and put in the image HTML:

<img src="http://www.yoursite.com/images/awards.gif">

in the custom profield field text input.

Then in postbit template, add $post[field26] anywhere you want the image to show up. For people without awards it won't show up. In getinfo template, add $userinfo[field26] instead. Change 26 to the profile id you are using.

See? No hacking needed. Best of all, no additional queries at all.
Reply With Quote
  #9  
Old 07-17-2003, 04:56 AM
Xelation's Avatar
Xelation Xelation is offline
 
Join Date: Jan 2002
Location: Buffalo, New York
Posts: 457
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks! will do that
Reply With Quote
  #10  
Old 07-17-2003, 05:03 AM
Xelation's Avatar
Xelation Xelation is offline
 
Join Date: Jan 2002
Location: Buffalo, New York
Posts: 457
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok now that I did that Im down to 23 queries which is perfect for me but one last time... is there anything else that could be brought down?


Query: SELECT template FROM template WHERE title='options'
Time before: 0.032304048538208
Time after: 0.033077955245972

--------------------------------------------------------------------------------

Query: SELECT sessionhash,userid,host,useragent,styleid FROM session WHERE lastactivity>1058421019 AND sessionhash='8840ab49cd89e1b94c671f9b9c48af33' AND (host='127.0.0.1' OR (althash='' AND althash<>'')) AND useragent='Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;'
Time before: 0.039862990379333
Time after: 0.040616989135742

--------------------------------------------------------------------------------

Query: SELECT user.*,userfield.* FROM user LEFT JOIN userfield ON userfield.userid=user.userid WHERE user.userid='1'
Time before: 0.040820002555847
Time after: 0.041581034660339

--------------------------------------------------------------------------------

Query: SELECT * FROM thread WHERE threadid=5
Time before: 0.042281985282898
Time after: 0.042878985404968

--------------------------------------------------------------------------------

Query: SELECT forum.forumid,styleid,styleoverride FROM forum,thread WHERE forum.forumid=thread.forumid AND threadid='5'
Time before: 0.043076038360596
Time after: 0.043728947639465

--------------------------------------------------------------------------------

Query: SELECT templatesetid,replacementsetid,userselect FROM style WHERE styleid='1'
Time before: 0.043871998786926
Time after: 0.044232964515686

--------------------------------------------------------------------------------

Query: SELECT template FROM template WHERE title='unregged' AND (templatesetid=-1 OR templatesetid=1) ORDER BY templatesetid DESC LIMIT 1
Time before: 0.044376015663147
Time after: 0.044971942901611

--------------------------------------------------------------------------------

Query: SELECT template,title
FROM template
WHERE (title IN ('showthread_searchthread','showthread_ratingdispl ay','postbit_search','postbit_buddy','postbit_igno re','postbit_useremail','icq','aim','yahoo','postb it_homepage','postbit_profile','postbit_ip_show',' postbit_ip_hidden','postbit','postbit_sendpm','pos tbit_avatar','postbit_offline','postbit_online','p ostbit_editedby','postbit_signature','postbit_atta chment','postbit_attachmentimage','showthread_admi noptions','showthread_threadrate','showthread_poll results_voted','showthread_pollresults_closed','sh owthread_pollresults_cantvote','showthread_firstun read','showthread_nextnewestthread','showthread_ne xtoldestthread','forumrules','showthread','unregge d','vbcode_smiliebit','vbcode_smilies','showthread _replybox','yesterday','today','gobutton','timezon e','username_loggedout','username_loggedin','phpin clude','headinclude','header','footer','forumjumpb it','forumjump','nav_linkoff','nav_linkon','navbar ','nav_joiner','pagenav','pagenav_curpage','pagena v_firstlink','pagenav_lastlink','pagenav_nextlink' ,'pagenav_pagelink','pagenav_prevlink')
AND (templatesetid=-1 OR templatesetid=1))


ORDER BY templatesetid
Time before: 0.045385956764221
Time after: 0.054196000099182

--------------------------------------------------------------------------------

Query: SELECT * FROM usergroup WHERE usergroupid=6
Time before: 0.057448029518127
Time after: 0.058225989341736

--------------------------------------------------------------------------------

Query: SELECT * FROM forum WHERE forumid='2'
Time before: 0.05901300907135
Time after: 0.059674024581909

--------------------------------------------------------------------------------

Query: SELECT *,INSTR(',2,1,-1,', CONCAT(',', forumid, ',') ) AS ordercontrol FROM forumpermission WHERE usergroupid=6 AND (forumid='2' OR forumid='1' OR forumid='-1') ORDER BY ordercontrol LIMIT 1
Time before: 0.059928059577942
Time after: 0.060505986213684

--------------------------------------------------------------------------------

Query: SELECT title, smilietext, smiliepath FROM smilie
Time before: 0.060677051544189
Time after: 0.061126947402954

--------------------------------------------------------------------------------


Warning: Cannot add header information - headers already sent by (output started at c:\phpdev\www\public\forum\global.php:155) in c:\phpdev\www\public\forum\admin\functions.php on line 1723
Query: SELECT * FROM forum WHERE forumid='1'
Time before: 0.067188024520874
Time after: 0.067926049232483

--------------------------------------------------------------------------------

Query: SELECT forumid,parentid,displayorder,title FROM forum WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder,forumid
Time before: 0.068737983703613
Time after: 0.069466948509216

--------------------------------------------------------------------------------

Query: SELECT forumid,canview FROM forumpermission WHERE usergroupid='6'
Time before: 0.069800972938538
Time after: 0.070139050483704

--------------------------------------------------------------------------------

Query: SELECT COUNT(*) AS posts FROM post WHERE post.threadid='5' AND post.visible=1
Time before: 0.0713210105896
Time after: 0.07197105884552

--------------------------------------------------------------------------------

Query:
SELECT post.postid FROM post
WHERE post.threadid='5' AND post.visible=1
ORDER BY dateline LIMIT 0,40

Time before: 0.072126984596252
Time after: 0.072932004928589

--------------------------------------------------------------------------------

Query:
SELECT
post.*,post.username AS postusername,post.ipaddress AS ip,user.*,userfield.*,icon.title as icontitle,icon.iconpath,
attachment.attachmentid,attachment.filename,attach ment.visible AS attachmentvisible,attachment.counter
,avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar,customavatar.dateline AS avatardateline
FROM post
LEFT JOIN icon ON icon.iconid=post.iconid
LEFT JOIN user ON user.userid=post.userid
LEFT JOIN userfield ON userfield.userid=user.userid
LEFT JOIN avatar ON avatar.avatarid=user.avatarid
LEFT JOIN customavatar ON customavatar.userid=user.userid
LEFT JOIN attachment ON attachment.attachmentid=post.attachmentid
WHERE post.postid IN (0,6,7,8,9,10,11,12,14,15,17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31)
ORDER BY dateline

Time before: 0.073382019996643
Time after: 0.083976984024048

--------------------------------------------------------------------------------

Query: SELECT smilietext,smiliepath FROM smilie
Time before: 0.086119055747986
Time after: 0.086783051490784

--------------------------------------------------------------------------------

Query: SELECT bbcodetag,bbcodereplacement,twoparams FROM bbcode
Time before: 0.10428297519684
Time after: 0.1049929857254

--------------------------------------------------------------------------------

Query: SELECT usergroupid FROM user WHERE userid=1
Time before: 0.20861601829529
Time after: 0.20922195911407

--------------------------------------------------------------------------------

Query:
SELECT findword, replaceword, replacementsetid
FROM replacement
WHERE replacementsetid IN(-1, '1')
ORDER BY replacementsetid, replacementid DESC

Time before: 0.22727394104004
Time after: 0.22868096828461

--------------------------------------------------------------------------------


Page generated in 0.21704995632172 seconds with 22 queries,
spending 0.03301465511322 doing MySQL queries and 0.1840353012085 doing PHP things.
Query: UPDATE session SET lastactivity=1058421919,location='/public/forum/showthread.php?s=&threadid=5&showqueries=1' WHERE sessionhash='8840ab49cd89e1b94c671f9b9c48af33' Time before: 0.26303398609161 Time after: 0.26349699497223
--------------------------------------------------------------------------------
Query: UPDATE user SET lastactivity=1058421919,inforum='2' WHERE userid='1' Time before: 0.26358199119568 Time after: 0.26394701004028
--------------------------------------------------------------------------------
Query: UPDATE LOW_PRIORITY thread SET views=views+1 WHERE threadid='5' Time before: 0.26403105258942 Time after: 0.26466202735901
--------------------------------------------------------------------------------



Thanks!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:33 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.11489 seconds
  • Memory Usage 2,291KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete