vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Query load (https://vborg.vbsupport.ru/showthread.php?t=44877)

Sia Bani 10-23-2002 12:17 AM

Query load
 
Hi all. Newbie here. I just installed Teck's microstats and this is what I'm getting for my index data:

Page generated in 0.11948705 seconds (60.20% PHP - 39.80% MySQL) with 32 queries.
[Debug Mode OFF] [PHP v4.2.2] [GZIP disabled] [Server Load: 0.10 ยป 0.47 : 0.63]

Is 32 queries too high? I only have about 60 members now, my forum is about 2 weeks old. Will I run into trouble with more users?

thanks.

Erwin 10-23-2002 12:35 AM

32 queries for index.php is not too bad. Considering an unhacked index.php gives only 17, 32 is almost doubled - so it depends on how busy your forums are going to get. How many members at one time? If overall you have 60 members, 32 is fine. :) The general rule is to get it at least below 30 if possible.

Sia Bani 10-23-2002 12:37 AM

thanks for the quick response. I've installed several hacks that I really want to keep, so is there anyway to minimize the queries without getting rid of teh hacks?

Erwin 10-23-2002 12:49 AM

Interesting drawing for a splash screen on your site. :) Like I was saying, there's no real need to reduce it with the number of members you've got now. You can rationalize the PM queries from 3 to 1 by replacing the current code in your index.php for PMs with this:

Quote:

$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages,
SUM(IF(dateline>$bbuserinfo[lastvisit] AND folderid=0,1,0)) AS newpm,
SUM(IF(messageread=0 AND folderid=0,1,0)) AS unreadpm
FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");

$newpm['messages']=$allpm['newpm'];
$unreadpm['messages']=$allpm['unreadpm'];
Also, if you don't need to know the number of threads in the forums, or the name of the newest member etc. - each one of those takes one query. Just remove the relevant lines in your index.php. Make sure all templates are listed in your templatesused ="" variable at the top, or else each template called is an extra query too.

Sia Bani 10-23-2002 12:59 AM

Hey, thanks a lot.

Erwin 10-23-2002 01:03 AM

No problems, glad to help. :)

Dean C 10-23-2002 09:28 AM

Erwin that code however if i remember correctly can add more queries under certain circumstances..

- miSt

Erwin 10-23-2002 11:59 AM

How? It's one query line. When you get a new PM, you get 2 extra queries, but that's not from this line of code, it's for the PM popup.

Xenon 10-23-2002 02:02 PM

Erwin is right mist ;)

@Sia: you should look if you have a query in a while - loop through one of your hacks.
if yes, this is a don't do ;)
ask in the supportthread if this can be optimized then :)

Dean C 10-23-2002 06:27 PM

Lol ill leave it to the advanced hackers ;)

I just had a hunch id seen that before and PPN said not to do it for some reason or another :)

- miSt

Xenon 10-23-2002 09:34 PM

he hasn't said it exactly to this optimization.

he just says sometimes it would be better to have more queries instead of one real great query :)
it always depends on the situation


All times are GMT. The time now is 03:50 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.01162 seconds
  • Memory Usage 1,728KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (11)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete