Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 02-19-2004, 02:11 PM
Aaron1's Avatar
Aaron1 Aaron1 is offline
 
Join Date: Oct 2002
Location: Amsterdam
Posts: 200
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Debug Modes & Queries

Hi, i was checking my slow loading 2.2.7 frontpage with debug modus on, and I noticed some of the queries takes a long time to load. I copied my showqueries option results here. Maybe you have any idea what is causing the delay?



Query: SELECT template FROM template WHERE title='options'
Time before: 0.18156504631042
Time after: 0.18442296981812

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

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

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

Query: INSERT INTO session (sessionhash,userid,host,useragent,lastactivity,al thash,location) VALUES ('d8708b9c36882818d86d05d69505c7c0','1','194.109.2 27.3','Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)','1077206999','','//forum/index.php?s=&showqueries=1')
Time before: 0.26929306983948
Time after: 0.27953791618347

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


Warning: Cannot add header information - headers already sent by (output started at /home/sites/site5/web/forum/global.php:145) in /home/sites/site5/web/forum/admin/functions.php on line 1700
Query: SELECT templatesetid,replacementsetid,userselect FROM style WHERE styleid='6'
Time before: 0.28320288658142
Time after: 0.28443598747253

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

Query: SELECT templatesetid,replacementsetid,userselect FROM style WHERE styleid='1' or styleid=1 ORDER BY styleid DESC
Time before: 0.28557991981506
Time after: 0.2870569229126

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

Query: SELECT template,title
FROM template
WHERE (title IN ('error_nopermission','forumhome_pmloggedin','foru mhome_welcometext',
'forumhome_logoutcode','forumhome_newposts','forum home_logincode',
'forumhome_loggedinuser','forumhome_loggedinusers' ,'forumhome_lastpostby',
'forumhome_moderator','forumhome_forumbit_level1_n opost',
'forumhome_forumbit_level1_post','forumhome_forumb it_level2_nopost',
'forumhome_forumbit_level2_post','forumhome','foru mhome_unregmessage',
'whos_chatting','gobutton','timezone','username_lo ggedout','username_loggedin',
'phpinclude','headinclude','header','footer','foru mjumpbit','forumjump','nav_linkoff',
'nav_linkon','navbar','nav_joiner','pagenav','page nav_curpage','pagenav_firstlink',
'pagenav_lastlink','pagenav_nextlink','pagenav_pag elink','pagenav_prevlink',
'home_microstats')
AND (templatesetid=-1 OR templatesetid='3'))
OR (title = 'maxloggedin')

ORDER BY templatesetid
Time before: 0.28862404823303
Time after: 0.49036908149719

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

Query: SELECT * FROM usergroup WHERE usergroupid=6
Time before: 0.50419306755066
Time after: 0.50593304634094

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

Query: SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=1 AND

messageread=0 AND folderid=0
Time before: 0.50736403465271
Time after: 0.51272797584534

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

Query: SELECT smilietext,smiliepath FROM smilie ORDER BY showid
Time before: 0.58423209190369
Time after: 1.3096740245819

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

Query: SELECT bbcodetag,bbcodereplacement,twoparams FROM bbcode
Time before: 1.3222870826721
Time after: 1.3240048885345

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

Query: SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=1
Time before: 1.3451330661774
Time after: 1.3466539382935

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

Query: SELECT COUNT(*) AS messages, IF(messageread>0, 0, SUM(IF(dateline>1077204189, 1, 0))) as newpm, messageread
FROM privatemessage
WHERE userid=1 AND (dateline>1077204189 OR messageread=0) AND folderid=0
GROUP BY messageread
ORDER BY messageread ASC
Time before: 1.3478310108185
Time after: 1.3501510620117

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

Query: SELECT COUNT(*) AS users,MAX(userid) AS max FROM user
Time before: 1.3542320728302
Time after: 1.3555300235748

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

Query: SELECT SUM(replycount) AS posts, SUM(threadcount) AS threads FROM forum WHERE parentid=-1
Time before: 1.3565609455109
Time after: 1.358757019043

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

Query: SELECT userid,username FROM user WHERE userid=5893
Time before: 1.3602700233459
Time after: 1.5186769962311

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

Query: SELECT COUNT(*) AS threads FROM thread WHERE dateline > '1077204189' and forumid <> '16' and forumid <> '54'
Time before: 1.5197339057922
Time after: 2.9511320590973

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

Query: SELECT count(*) AS posts FROM post,thread WHERE post.dateline > '1077204189' and thread.threadid=post.threadid and thread.forumid <> '16' and forumid <> '54'
Time before: 2.952183008194
Time after: 3.2847220897675

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

Query: SELECT * FROM forum WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder
Time before: 3.2911870479584
Time after: 3.2957348823547

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

Query: SELECT forumid,canview,canpostnew FROM forumpermission WHERE usergroupid='6'
Time before: 3.3067030906677
Time after: 3.3082830905914

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

Query: SELECT forumid,accessmask FROM access WHERE userid='1'
Time before: 3.3097970485687
Time after: 3.3554339408875

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

Query: SELECT COUNT(*) AS users,session.userid,username,IF(session.userid=0, 2,invisible) AS invisible,usergroupid,forumid
FROM session
LEFT JOIN user ON (user.userid=session.userid)
LEFT JOIN moderator ON (moderator.userid=session.userid)
WHERE session.lastactivity>1077206502
GROUP BY session.userid
ORDER BY invisible ASC, username ASC
Time before: 3.3566598892212
Time after: 3.3748419284821

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

Query: SELECT findword,replaceword FROM replacement WHERE replacementsetid IN(-1,'7') ORDER BY replacementsetid DESC,replacementid DESC
Time before: 4.6192750930786
Time after: 5.5579769611359

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

Page generated in 4.3163781166077 seconds with 22 queries,
spending 3.8930354118347 doing MySQL queries and 0.42334270477295 doing PHP things.
Query: DELETE FROM session WHERE sessionhash='' Time before: 7.7143399715424 Time after: 7.9610960483551
--------------------------------------------------------------------------------
Query: UPDATE user SET lastactivity=1077206999 WHERE userid='1' Time before: 7.9617660045624 Time after: 8.0490210056305
-----------------------------------------------------------------------------------------------


Any help from you would be highly appreciated! I would live to see my homepage load faster. But i have no clue how to do it
Reply With Quote
  #2  
Old 02-19-2004, 02:34 PM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just checked your hompage and it was fine.... loaded in 1.16 secs with 17 queries....did you change anything?
Reply With Quote
  #3  
Old 02-19-2004, 02:48 PM
Aaron1's Avatar
Aaron1 Aaron1 is offline
 
Join Date: Oct 2002
Location: Amsterdam
Posts: 200
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi, wow that's fast! Weird though, because when i check the homepage (not logged in) i get: Page loaded in 7.75 seconds - 7.57% Php - 92.43% MySql with 17 queries.
I think some querie is looping on the frontpage somehow, i am really not sure what's causing the huge delay.

FYI, i have the optimizing forumhome hack from Xenon installed.
Reply With Quote
  #4  
Old 02-19-2004, 03:48 PM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Aaron1
FYI, i have the optimizing forumhome hack from Xenon installed.
Ahhh, thats your problem...j/k. Anyway I just checked it again and I'm not logged in as well and I still don't see any problems.

Here is what I see:

Page loaded in 1.21 seconds - 44.36% Php - 55.64% MySql with 17 queries.
Reply With Quote
  #5  
Old 02-19-2004, 04:44 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

maybe your server was just having problems at that time.

regarding your query log:

Quote:
Query: SELECT findword,replaceword FROM replacement WHERE replacementsetid IN(-1,'7') ORDER BY replacementsetid DESC,replacementid DESC
Time before: 4.6192750930786
Time after: 5.5579769611359
Quote:
Query: SELECT smilietext,smiliepath FROM smilie ORDER BY showid
Time before: 0.58423209190369
Time after: 1.3096740245819
those two queries shouldn't take THAT much time, so i assume either a temporarly server prob, or maybe try to run repair.php to optimize your tables
Reply With Quote
  #6  
Old 02-19-2004, 05:43 PM
Aaron1's Avatar
Aaron1 Aaron1 is offline
 
Join Date: Oct 2002
Location: Amsterdam
Posts: 200
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Xenon will try that, but i am also worried about these queries:

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

Warning: Cannot add header information - headers already sent by (output started at /home/sites/site5/web/forum/global.php:145) in /home/sites/site5/web/forum/admin/functions.php on line 1700
Query: SELECT templatesetid,replacementsetid,userselect FROM style WHERE styleid='6'
Time before: 0.28320288658142
Time after: 0.28443598747253

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

Query: SELECT count(*) AS posts FROM post,thread WHERE post.dateline > '1077204189' and thread.threadid=post.threadid and thread.forumid <> '16' and forumid <> '54'
Time before: 2.952183008194
Time after: 3.2847220897675
--------------------------------------------------------------

Why is there this warning: cannot add header information?

And the last querie, is for a hack to show how many posts/threads the members since their last visit. But that one is very slow too. Any way to optimize that querie?
Reply With Quote
  #7  
Old 02-19-2004, 06:50 PM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Make sure there is no white space before the <? at the top of admin/functions.php or after the ?> at the end of the file.
Reply With Quote
  #8  
Old 02-19-2004, 07:31 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, you can ignore the headers warning.

this will be on every explain=1 page.
Really nothing to worry about

As for the second query: well, you can set up an index for the dateline column of the post table, but apart from that there isn't much you can do.
joining the post and thread table is always slow

maybe change the query into:
[sql]SELECT count(*) AS posts
FROM post
INNER JOIN thread USING(threadid)
WHERE post.dateline > '1077204189'
AND thread.forumid NOT IN (16, 54)[/sql]

it could speed up it a little bit.
Reply With Quote
  #9  
Old 02-19-2004, 07:51 PM
Aaron1's Avatar
Aaron1 Aaron1 is offline
 
Join Date: Oct 2002
Location: Amsterdam
Posts: 200
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I could try that, thanks!
So you mean instead of: WHERE post.dateline > '1077204189'

you are meaning:

post.dateline > '$bbuserinfo[lastvisit]'

I presume?
Reply With Quote
  #10  
Old 02-19-2004, 08:19 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes, exactly, just without the '

Reply With Quote
Reply

Thread Tools
Display Modes

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:07 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06583 seconds
  • Memory Usage 2,263KB
  • Queries Executed 11 (?)
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
  • (3)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_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