vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   I Can't Believe the Difference in Speed (https://vborg.vbsupport.ru/showthread.php?t=50244)

amykhar 03-16-2003 02:22 AM

I Can't Believe the Difference in Speed
 
Google has finally started crawling my board and guest traffic has started to increase. Things started to get rather sluggish. I upgraded my hosting plan to get more RAM and it helped somewhat, but not dramatically.

Then, I put an index on the dateline column in the posts table. OMG I can't believe the difference. Parts of the VBstats hack used to drive server load way up before. Now, I can actually use it without a wimper from the server. I can also use the hack that shows how many posts were made since the last visit now. Before, it just wasn't feasible.

My board isn't huge, but a decent size. If your medium to large board is starting to struggle, you might want to try this. I didn't do it in the past because I kept seeing Freddie telling people that it wasn't necessary. But I am really seeing a huge improvement.

Amy

Freddie Bingham 03-16-2003 03:47 AM

If I say anything I am only referencing a non hacked forum when I say we are happy with the indexes that we have.

Boofo 03-16-2003 04:00 AM

Quote:

Today at 10:22 PM amykhar said this in Post #1
Google has finally started crawling my board and guest traffic has started to increase. Things started to get rather sluggish. I upgraded my hosting plan to get more RAM and it helped somewhat, but not dramatically.

Then, I put an index on the dateline column in the posts table. OMG I can't believe the difference. Parts of the VBstats hack used to drive server load way up before. Now, I can actually use it without a wimper from the server. I can also use the hack that shows how many posts were made since the last visit now. Before, it just wasn't feasible.

My board isn't huge, but a decent size. If your medium to large board is starting to struggle, you might want to try this. I didn't do it in the past because I kept seeing Freddie telling people that it wasn't necessary. But I am really seeing a huge improvement.

Amy

Will the only help with vbststs or will it also help if you are not running that? If so, what do we need to do to accomplish that?

Weasel 03-16-2003 04:39 AM

What happens when two people post at the exact same second?

doesnt index make sure there are no duplicate values?

Dean C 03-16-2003 08:40 AM

So you simple add an index to one column and it fixed all your problems :)?

How do we do this :D?

And your board is HUGEEE!! Do you make the ea games?

- miSt

N9ne 03-16-2003 12:50 PM

Quote:

Today at 10:40 AM Mist said this in Post #5
So you simple add an index to one column and it fixed all your problems :)?

How do we do this :D?

And your board is HUGEEE!! Do you make the ea games?

- miSt

Amy's forum has nothing to do with EA Games or anything lol.

Amy, please share how you did this ;).

Dean C 03-16-2003 01:04 PM

I'm getting confused with electronic arts's forums :)

- miSt

amykhar 03-16-2003 01:33 PM

1. We don't make EA games. However, a teenager joined once who thought we did and ripped us a new one because "our" games suck. Once we explained who we were, we figured we would never see him again. However, he still comes back from time to time when he needs help or wants to chat :D

2. Back on topic. The query I used was:

ALTER TABLE `post` ADD INDEX(`dateline`);

3. It helps quite a bit with vbstats, but I am also seeing a general speed increase. I did notice that takes a wee bit longer to post - but that is to be expected. From what I have read an index makes an insert take longer but a select faster.

4. Freddie, sorry I misunderstood.

I honestly don't believe we are a "huge" board. I prune periodically and keep things a reasonable size.

Amy

RS25com 05-06-2003 06:03 PM

Hm, I tried this and it does seem to be significantly faster. I simply used PhpMyAdmin and clicked the "Index" link next to the appropriate column. :D

I run a small-ish board - 2200 members, 7900 threads and 104000 posts - on an IIS box - for those who are interested.

Dean C 05-06-2003 06:41 PM

How does it makes things faster?

- miSt

amykhar 05-06-2003 07:04 PM

It makes queries to the post table faster because the index orders the posts. So, queries that look for posts since a given date are significantly sped up.

Boofo 05-06-2003 07:27 PM

Quote:

Today at 03:04 PM amykhar said this in Post #11
It makes queries to the post table faster because the index orders the posts. So, queries that look for posts since a given date are significantly sped up.
Does it do it retroactively or just with posts made after adding the query?

Xenon 05-06-2003 07:34 PM

an DB index is for all data in the table, not just for the new ones ;)

btw. to speed up the getnew post you can add also an index to thread.lastpost :)

it reduced the gen time on vb.org from .27 to .07 ;)

Erwin 05-07-2003 02:24 AM

Good tips. :)

Boofo 05-07-2003 05:04 AM

Any other places where an index might help speed things up?

Dolby 05-07-2003 07:32 AM

Any drawbacks to doing this? Can it be un-done?

Xenon 05-07-2003 08:28 AM

@boofo: currently i don't know any others, but i'm sure there can be some.
but it's also depending on your hacks and so on, where you could need an index :)

@Dolby: well each index requires DB Space
you can see on the tablestatistics how much space the data takes and how much the indexes take.
yes it can be un-done :)

Erwin 05-07-2003 10:26 AM

FWIW, I added indexes to post.dateline, thread.lastpost as well as thread.lastposter - did speed things up at my site. :)

Boofo 05-07-2003 10:34 AM

Quote:

Today at 06:26 AM Erwin said this in Post #18
FWIW, I added indexes to post.dateline, thread.lastpost as well as thread.lastposter - did speed things up at my site. :)
How much overhead does each index add to the db? Just curious. ;)

cinq 05-07-2003 12:46 PM

Is there any downsides to doing this ?

Also what should i do to implement this ?
Basic instructions would be appreciated ( nooB here )

Xenon 05-07-2003 12:59 PM

cinq, everything is exactly mentioned here, i posted the downsides 3 posts above.

cinq 05-07-2003 01:14 PM

Dbspace ie. the database just gets bigger right ?
Will the increase be so substantial that it is something to worry about ?

So the command i use in phpmyadmin is run this query ?

ALTER TABLE `post` ADD INDEX(`dateline`);

Just wish to confirm and not do something wrong and foul up the board :)

Thanks

Dolby 05-07-2003 06:20 PM

Since it can be un-done ( looks like you just go into phpmyadmin and click on the drop button where it lists the indexs) I tried it and vbstats show some increase in speed. I was at about "Page generated in .8xxx" and its now about "Page generated in .06xxx" on my forum index.

Currently have 112 online browseing.

okrogius 05-07-2003 07:24 PM

Downsize to too much indexes is not just extra database space. While adding an index to thread.lastpost speeds up Get New Posts, it also slows down New Thread/Reply.

Dolby 05-07-2003 09:14 PM

Hmmm seems just as fast if not faster on my busy board to make a new thread or reply. *shrug*

Erwin 05-08-2003 09:46 AM

Quote:

Downsize to too much indexes is not just extra database space. While adding an index to thread.lastpost speeds up Get New Posts, it also slows down New Thread/Reply.
As most of the database load is from guests browsing the forums, rather than posting, the trade-off is well worth it.

TTG 07-02-2004 10:55 AM

I added the ALTER TABLE `post` ADD INDEX(`dateline`); and must admit my board seem to load a lot faster.

What are the codes to add for post.dateline, thread.lastpost as well as thread.lastposter

chris2707 07-02-2004 02:09 PM

Can this be done with the board open and users using the vB?

Xenon 07-02-2004 02:11 PM

yes :)

RichieBoy67 07-02-2004 03:48 PM

Great Tip! Amazing speedup!!!

Thanks-- I just did this to both my sites and it is awesome and so dam simple...

Jolten 07-02-2004 04:24 PM

Wow. Although I wasn't at all unhappy with the speed of my tiny little forum adding indexes to post.dateline, thread.lastpost, and thread.lastposter has made pages load exceptionally fast. Thanks for this Amy!

soopa 07-02-2004 05:22 PM

good stuff :devious:

Gamingforce 07-03-2004 01:07 AM

I just added an index to post.dateline and thread.lastpost. Speed seems a little faster and database insertions into the post/thread tables don't seem too bad. My board has 150-300 users, on average and has around 850,000 posts.

I would recommend this simple modification to anyone.

Velocd 07-03-2004 03:17 AM

In addition to regularly optimizing your index tables, indexing can be a big help on columns when quering.

More information:
http://dev.mysql.com/doc/mysql/en/MySQL_indexes.html

Another good read on general database optimization:
http://dev.mysql.com/doc/mysql/en/Op...Structure.html

Boofo 07-03-2004 03:37 AM

In phpmyadmin, how can you tell if something already has an index for it?

Natch 07-03-2004 04:19 AM

In the Structure layout, roll down the the bottom - there is an Index summary table below the main layout...

Boofo 07-03-2004 04:49 AM

Quote:

Originally Posted by Natch
In the Structure layout, roll down the the bottom - there is an Index summary table below the main layout...

Thank you, sir. I needed to check if I had more then 1 index for a couple of these and I did. Now all is well. ;)

Oblivion Knight 07-03-2004 01:28 PM

Quote:

Originally Posted by TTG
I added the ALTER TABLE `post` ADD INDEX(`dateline`); and must admit my board seem to load a lot faster.

What are the codes to add for post.dateline, thread.lastpost as well as thread.lastposter

ALTER TABLE `thread` ADD INDEX(`lastpost`);

ALTER TABLE `thread` ADD INDEX(`lastposter`);



Strangely, my forum seems to load faster, but the Microstats don't reflect this..

Viewing a thread before:
Page generated in 0.11889291 seconds (92.06% PHP - 7.94% MySQL) with 13 queries

Viewing a thread after:
Page generated in 0.50758195 seconds (96.13% PHP - 3.87% MySQL) with 13 queries

MickDoneDee 07-18-2004 04:25 PM

I indexed the following as mentioned in the previous posts:

post.dateline
thread.lastpost
thread.lastposter

Adding indexes for thread.lastpost and thread.lastposter only increased the space usage by about 10,000 bytes.

I didn't notice a discernable difference in speed when loading the index page or forumdisplay page.

I turned the debug mode on in the config.php file so that the controls appeared at the bottom of the forum pages. Then I clicked (Explain) which loaded http://www.myforum.com/?explain=1

This detailed all the Queries that were run. I checked through this for the index page and forumdisplay page. I couldn't find any reference to post.dateline, thread.lastpost or thread.lastposter. So page load speed for the index page or forumdisplay page can't be influenced by those three new indexes. Question is: which pages do load faster as a result of those three indexes?

If your config.php file doesn't already contain $debug, add it to the bottom of the file as I've shown here. To prevent other users from accessing it add your IP address where I've indicated. You can get your IP address from Who's Online if you are logged on.

PHP Code:

// Prefix that all vBulletin cookies will have
// For example
$cookieprefix 'bb';

// ****** DEBUG MODE ON/OFF ******
// Turn debug on with '1' otherwise leave it blank to disable it.
$debug '1';

if (
$_SERVER['REMOTE_ADDR'] == 'your IP address')
{
$debug 1;
} else {
$debug 0;


/*======================================================================*\
|| ####################################################################
|| # Downloaded: 19:34, Mon Apr 5th 2004
|| # CVS: $RCSfile: config.php.new,v $ - $Revision: 1.19 $
|| ####################################################################
\*======================================================================*/
?> 

https://vborg.vbsupport.ru/external/2011/01/19.gif Another feature that is activated with debug on is the Admin Help Manager which appears in the vBulletin Options menu within the Admin CP.

MickDoneDee 07-18-2004 05:11 PM

1 Attachment(s)
To add an index in your phpmyadmin the attached images will help to explain it.

Load the page which displays all the tables. See part of this page in PhpMyAdmin 2001.jpg

Notice that each table has a Properties column. Choose your table and click Properties in that row. See PhpMyAdmin 9001s.jpg for the Post table.

Notice that each property has an Index column. You can also see a table at the bottom which shows existing indexes. You don't want to create one if it already exists. Choose your property and click Index in that row.

See PhpMyAdmin 11001.jpg that shows a message to say the index has been added.

See PhpMyAdmin 12001.jpg that shows that the property "dateline" has been added to the list of indexes.

Hope this helps make sense of it all.


All times are GMT. The time now is 06:59 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.01417 seconds
  • Memory Usage 1,830KB
  • 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_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete