vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   improved dot icons - decreases DB load (https://vborg.vbsupport.ru/showthread.php?t=48436)

pwr_sneak 02-01-2003 10:00 PM

improved dot icons - decreases DB load
 
This Hack will decrease the Load on your DB-Server.
It adds one small Query to forumdisplay.php and modifies one big, slow query.
If you have lots of posts and $showdots enabled, this is a must.
If you disabled $showdots via Admin-CP because of performance issues, you can savely enable it now :)

Note: this will NOT work with PHP 3.x or lower

UPDATE: I've added instructions to modifiy member2.php, usercp.php and search.php

ScottRoberts 02-02-2003 12:04 PM

Quote:

Originally posted by pwr_sneak

Note: this will NOT work with PHP 3.x or lower

Or lower? Means it will not work at all...or should this be higher?

pwr_sneak 02-02-2003 12:10 PM

means it will just work with PHP 4 or higher.

Xenon 02-02-2003 12:14 PM

hey, looks very good pwr_sneak.
Joining thread and post table is really a bad thing, so cut them out this way looks good.

Have you some testresults to see the time the two queries take instead of just the one before (just intrested in..)

pwr_sneak 02-02-2003 12:25 PM

Quote:

Originally posted by Xenon
Have you some testresults to see the time the two queries take instead of just the one before (just intrested in..)
the one before showed up often in my slowqueries.log and took much longer than 10 seconds sometimes.
the two new queries takes 13 millisecondes :p

nuno 02-02-2003 12:45 PM

Are you sure it's faster?
I tested this locally and it doesn't seem to be any faster. :confused:

pwr_sneak 02-02-2003 01:05 PM

if you test it with small post and thread tables it wouldn't make a huge difference, but the original code doesn't scale very well.
my forum got 1.4 million posts and 47k threads and it definitely is MUCH faster

nuno 02-02-2003 01:09 PM

OK, i'll upload the new forumdisplay to live forums and let you know how it goes then.
Back in a mo.

nuno 02-02-2003 01:27 PM

I see some improvement finally, it went from 0.095 to 0.090. :)

Chris M 02-02-2003 02:31 PM

Nice:)

Satan

Dean C 02-02-2003 03:49 PM

Cool hack buddy :)

- miSt

CJi 02-02-2003 06:35 PM

Is there any way this can be implemented for search.php (view new posts) as well? Most of our members use that, which, to say the least, generates a lot of unwanted load.

Thanks :)

MarkB 02-02-2003 06:43 PM

Installed - here's hoping it works ;)

Xenon 02-02-2003 06:59 PM

Quote:

Originally posted by nuno
I see some improvement finally, it went from 0.095 to 0.090. :)
well for those tests these infos is not very helpfull, if you want to test differences between queries you have to use em in loops.

so compare to run 100 times the big old one with 100 times the small two new and you'll see the effects really :)

pwr_sneak 02-02-2003 07:19 PM

Quote:

Originally posted by CJi
Is there any way this can be implemented for search.php (view new posts) as well? Most of our members use that, which, to say the least, generates a lot of unwanted load.

Thanks :)

I've updated the instructions for search.php, usercp.php and member2.php :)

djr 02-02-2003 09:29 PM

I noticed some differences in member2.php and usercp.php. You used dojoin instead of dotjoin. I guess it has to be dotjoin like the others, so I changed it in my setup. Can you confirm this as a typo in the textfile/instructions or does it have to be dojoin

- djr

pwr_sneak 02-03-2003 08:20 AM

you're right, this is a typo.
It won't change anything but $dotjoin is right ;)
I found this typo in the original member2.php too (2.2.9).

My Instructions have been updated once again.

CJi 02-03-2003 07:18 PM

pwr_sneak: You rule sir. Thank you :)

cturcich 02-11-2003 12:33 AM

good find, however my forums are still slow with dot folders :(

this has decreased the load time though...

Erwin 02-11-2003 03:57 AM

Interesting... :) Another example of how 2 queries sometimes can be better than 1. :)

Tigga 02-11-2003 05:44 AM

Very nice pwr_sneak! When I tested it my forumdisplay page was loading in 1.2 - 3 seconds. Afterwards it's loading in 0.3 - 0.6. :D

nuno 02-13-2003 10:05 PM

Quote:

Originally posted by Erwin
Interesting... :) Another example of how 2 queries sometimes can be better than 1. :)
Exactly.
Now go explain that to Allen Ayres. :D

Xenon 02-14-2003 10:32 AM

have installed it on my board, too

i have a small board, but even there the generation time reduced by a half..

Bad Bunny 02-14-2003 12:31 PM

Inteseresting! I think I will save myself the trouble and do it now.
Thank you very much for this performance hack.

agfisdn 04-06-2003 06:33 AM

nice hack!

thanx pwr_sneak !

Alien 05-03-2003 08:12 PM

Thanks a bunch, works great!

-Jason

Austin Dea 05-03-2003 08:17 PM

There should be a section in the db for performance enhancing/optimization hacks =).

Nice hack ;)

Xenon 05-04-2003 08:08 PM

Quote:

Yesterday at 23:17 Austin Dea said this in Post #27
There should be a section in the db for performance enhancing/optimization hacks =).

Nice hack ;)


i don't think 2 or 3 hacks make such a section really needed ;)

Austin Dea 05-05-2003 02:43 AM

Yeah, I thought about that after I said it.. plus there can't be that many optimizations =P

Xenon 05-05-2003 05:43 PM

oh there can ^^

wait until you see vb3 ^^

Austin Dea 05-05-2003 07:50 PM

Well, but that's all different code =P. I meant there can't be THAT many optimizations to vB2 without re-coding the entire thing ;)

Xenon 05-06-2003 04:06 PM

ok, that's right.

you have to recode some things to optimize it :)

Gutspiller 07-05-2003 12:12 AM

Instructions say:
Quote:

in MEMBER2.PHP

a) OLD CODE
--------
if ($showdots and $bbuserinfo[userid] >= 1) {
$dotuserid = "DISTINCT post.userid,";
$dotjoin = "LEFT JOIN post ON (thread.threadid = post.threadid AND post.userid = '$bbuserinfo[userid]' AND post.visible = 1)";
} else {
$dotuserid = "";
$dotjoin = "";
}
NEW CODE
--------
$dotuserid = "";
$dotjoin = "";
What I got:

Quote:

if ($showdots and $bbuserinfo[userid] >= 1) {
$dotuserid = "DISTINCT post.userid,";
$dotjoin = "LEFT JOIN post ON (thread.threadid = post.threadid AND post.userid = '$bbuserinfo[userid]')";
}

$getthreadids=$DB_site->query("SELECT thread.threadid
FROM thread,subscribethread
WHERE subscribethread.threadid=thread.threadid
AND subscribethread.userid='$bbuserinfo[userid]'
AND thread.visible=1 $datecut $ignoreusers
ORDER BY lastpost DESC
LIMIT ".($limitlower-1).",$perpage
");
$totalthreads=$DB_site->num_rows($getthreadids);

if ($totalthreads>0) {
What do I do?

pwr_sneak 07-13-2003 02:53 PM

you could try to read the code and understand how it works :P
which vbulletin version do you use? if its not the latest stable (2.3.0), try to update it.

sabret00the 08-10-2003 02:37 PM

how many ppl installed this?

edit: check the forumdisplay :)


All times are GMT. The time now is 02:45 AM.

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.01167 seconds
  • Memory Usage 1,779KB
  • 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
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (35)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