Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 09-29-2009, 08:22 PM
Draving Draving is offline
 
Join Date: Jun 2006
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default What This slow Query ?

Hi, sorry my bad english

There is a very slow query in my database:

Code:
Matar el proceso 	68882 	DB 	localhost 	DB 	Query 	1627 	Sending data 	SELECT user . * , usertextfield . * , userfield . * , user.userid, options, IF( displaygroupid =0, user.usergr
Matar el proceso 	69228 	DB 	localhost 	DB 	Query 	1604 	Sending data 	SELECT user . * , usertextfield . * , userfield . * , user.userid, options, IF( displaygroupid =0, user.usergr
Matar el proceso 	69618 	DB 	localhost 	DB 	Query 	1577 	Sending data 	SELECT user . * , usertextfield . * , userfield . * , user.userid, options, IF( displaygroupid =0, user.usergr
Matar el proceso 	69979 	DB 	localhost 	DB 	Query 	1552 	Sending data 	SELECT user . * , usertextfield . * , userfield . * , user.userid, options, IF( displaygroupid =0, user.usergr
Matar el proceso 	71301 	DB 	localhost 	DB 	Query 	1319 	Sending data 	SELECT user . * , usertextfield . * , userfield . * , user.userid, options, IF( displaygroupid =0, user.usergr
Matar el proceso 	73978 	DB 	localhost 	DB 	Query 	885 	Sending data 	SELECT SUM( IF( lastvisit >=1251665384, 1, 0 ) ) AS active, COUNT( * ) AS users, MAX( userid ) AS max
Matar el proceso 	74715 	DB 	localhost 	DB 	Query 	755 	Sending data 	SELECT SUM( IF( lastvisit >=1251665427, 1, 0 ) ) AS active, COUNT( * ) AS users, MAX( userid ) AS max
Matar el proceso 	74976 	DB 	localhost 	DB 	Query 	727 	Sending data 	SELECT SUM( IF( lastvisit >=1251665441, 1, 0 ) ) AS active, COUNT( * ) AS users, MAX( userid ) AS max
Matar el proceso 	75078 	DB 	localhost 	DB 	Query 	718 	Sending data 	SELECT SUM( IF( lastvisit >=1251665448, 1, 0 ) ) AS active, COUNT( * ) AS users, MAX( userid ) AS max
How can I optimize or eliminate this Query?

Thanks
Reply With Quote
  #2  
Old 09-29-2009, 08:26 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Which query ? You have listed 9 in that post, also they are cutoff.
Reply With Quote
  #3  
Old 09-29-2009, 08:53 PM
Draving Draving is offline
 
Join Date: Jun 2006
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

These 2 Query:

Code:
SELECT user . * , usertextfield . * , userfield . * , user.userid, options, IF( displaygroupid =0, user.usergr
and

Code:
SELECT SUM( IF( lastvisit >=1251665427, 1, 0 ) ) AS active, COUNT( * ) AS users, MAX( userid ) AS max
Thanks

--------------- Added [DATE]1254262396[/DATE] at [TIME]1254262396[/TIME] ---------------

My Forum is Great has over 1 million users, over 3 Million Post and 3k users online ...

Mysql get started to go wrong for 7 days and always works well in 2 years, someone can help me?
Reply With Quote
  #4  
Old 09-29-2009, 09:19 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What version of vb are you using? I did a search in the files for "user.*, usertextfield.*" and got one hit and that is not the query. That query looks like an added query because it then has user.userid in the select statement and yet that field is already in the select statement. So, I'd say that one is from a modification.

The second qury looks to be from includes/functions_databuild.php - build_user_statistics. It should not be running often at all since the description of the function is "Save user count & newest user into template" unless you have a really busy forum with lots of new users.
Reply With Quote
  #5  
Old 09-29-2009, 10:10 PM
Draving Draving is offline
 
Join Date: Jun 2006
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Upgrade from 3.6.8 to latest version 3.8.4 this week to see if it solved the problem, but even this foot wrong.

I have many records per second, is there any way to optimize the second Query?
Reply With Quote
  #6  
Old 09-29-2009, 10:21 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you still get the problem if you disable your modifications?
Note: To temporarily disable the plugin system, edit config.php and add this line right under <?php

PHP Code:
define('DISABLE_HOOKS'true); 
Reply With Quote
  #7  
Old 09-29-2009, 10:24 PM
Draving Draving is offline
 
Join Date: Jun 2006
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If the problem is that I use HIDE, and I have many records of users per second ....

4500 + per day

Is there any way to optimize the registry?

--------------- Added [DATE]1254268321[/DATE] at [TIME]1254268321[/TIME] ---------------

I've stopped Register Vbulletin users and the problem was solved ...

There any way to optimize the registry for many endurance records per second?
Reply With Quote
  #8  
Old 10-01-2009, 03:31 PM
Draving Draving is offline
 
Join Date: Jun 2006
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The solution to the second query is going to:

VBulletin Options - Home of the forum and put 0 in the Cropping Members

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

The First Query is not yet that is, someone knows what is?

Code:
SELECT user . * , usertextfield . * , userfield . * , user.userid, options, IF( displaygroupid =0, user.usergr
Thanks

--------------- Added [DATE]1254416433[/DATE] at [TIME]1254416433[/TIME] ---------------

I found it

If anyone has the same problem, the solution to clear the query:

Code:
SELECT user.*,usertextfield.*,userfield.*, user.userid, options,
	IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid

,avatar.avatarpath,NOT ISNULL(customavatar.userid) AS hascustomavatar,customavatar.dateline AS avatardateline, customavatar.width AS avwidth, customavatar.height AS avheight

 , lastactivity AS lastvisittime
Is disabling the Members List
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 02:55 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.04084 seconds
  • Memory Usage 2,231KB
  • 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
  • (5)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete