Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-01-2004, 09:32 PM
buro9 buro9 is offline
 
Join Date: Feb 2002
Location: London, UK
Posts: 585
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Memberlist if Profile Pic is shown

My memberlist.php was taking some 6 or 7 seconds to display, and I only have 1,200 users.

Not good enough.

Poking around I saw in member.php this:
PHP Code:
" . iif($show['profilepiccol'], "LEFT JOIN " . TABLE_PREFIX . "customprofilepic AS customprofilepic ON (user.userid customprofilepic.userid") . " 
It's part of the SQL that retrieves the data for the page. Notice how it joins to customprofilepic.userid?

Well that column isn't indexed on customprofilepic, so for each member in the main query (1,200 in my case) it did a full table scan looking for the userid within customprofilepic.

I added the index:
[SQL]
ALTER TABLE `customprofilepic` ADD INDEX ( `userid` )
[/SQL]

And now the page takes 0.07 seconds to display.

That's a 100x speed increase.

I suggest that anyone who has profile pics visible on their member list adds the index to MySql as above. It will make a marked difference in the page load time.

Cheers

David K
Reply With Quote
  #2  
Old 07-01-2004, 09:45 PM
nexialys
Guest
 
Posts: n/a
Default

looks like many queries have to be maximised that way.. this is the third hack about indexing this week... vB guys may have to expand their actual roadmap to add indexation to the 3.0.2
Reply With Quote
  #3  
Old 07-01-2004, 09:50 PM
buro9 buro9 is offline
 
Join Date: Feb 2002
Location: London, UK
Posts: 585
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, I've added quite a few after noticing it a few weeks ago, but none have been as dramatic as this one which is why I thought I should share.

To be frank... it's not really a hack. I just hoped that it might be allowed to stay just to help those who are affected by it
Reply With Quote
  #4  
Old 07-01-2004, 09:52 PM
nexialys
Guest
 
Posts: n/a
Default

one vB owner just released a similar hack, so i suppose they will
Reply With Quote
  #5  
Old 07-01-2004, 10:20 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm, on my db scheme userid has already an index on that table.

are you sure you did not delete that one accidentally before?
Reply With Quote
  #6  
Old 07-02-2004, 02:42 AM
Crinos's Avatar
Crinos Crinos is offline
 
Join Date: Oct 2001
Location: Los Angeles, CA
Posts: 151
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Xenon
hmm, on my db scheme userid has already an index on that table.
Ditto ...

Anyway, 0.3 seconds constantly when accessing memberlist (almost 10,000 members) ... dunno if that's normal though... running 3.0.1...
Reply With Quote
  #7  
Old 07-02-2004, 05:18 AM
buro9 buro9 is offline
 
Join Date: Feb 2002
Location: London, UK
Posts: 585
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Xenon
hmm, on my db scheme userid has already an index on that table.

are you sure you did not delete that one accidentally before?
Hehe, I'm very sure that I didn't delete indexes

Might look back to see what version installed it.

I have 3 installations, 2 of which are upgrades and were installed over the last few days. They have the index. It was the fresh install version that I've been running on for 3 months that didn't have the index, and that's been hacked... I'm already suspecting that some naughty hack writer has done some nasty deed with my database.

Thankfully I keep all hacks that install well documented, so I'll go through tomorrow and piece together quite why I didn't have this essential index in place.
Reply With Quote
  #8  
Old 07-02-2004, 05:27 AM
buro9 buro9 is offline
 
Join Date: Feb 2002
Location: London, UK
Posts: 585
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by buro9
Hehe, I'm very sure that I didn't delete indexes

Might look back to see what version installed it.

I have 3 installations, 2 of which are upgrades and were installed over the last few days. They have the index. It was the fresh install version that I've been running on for 3 months that didn't have the index, and that's been hacked... I'm already suspecting that some naughty hack writer has done some nasty deed with my database.

Thankfully I keep all hacks that install well documented, so I'll go through tomorrow and piece together quite why I didn't have this essential index in place.
Found it:

https://vborg.vbsupport.ru/showthread.php?t=63733

And in their code:
[sql]
ALTER TABLE `customprofilepic` DROP PRIMARY KEY;
ALTER TABLE `customprofilepic` ADD picture_id int(10) unsigned NOT NULL default '0' AUTO_INCREMENT PRIMARY KEY AFTER userid;
[/sql]

Their ought to be punishments for hackers that do things like this!
Reply With Quote
  #9  
Old 07-02-2004, 10:52 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

so, as this isn't a hack, just a bugfix then, i have moved it t general mod discussions

As for VeloCD's hack, i assume it was just a mistake. The auto_increment field has to be the primary key, so he just forgot to readd the normal index back..
Reply With Quote
  #10  
Old 07-02-2004, 12:54 PM
buro9 buro9 is offline
 
Join Date: Feb 2002
Location: London, UK
Posts: 585
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Xenon
so, as this isn't a hack, just a bugfix then, i have moved it t general mod discussions

As for VeloCD's hack, i assume it was just a mistake. The auto_increment field has to be the primary key, so he just forgot to readd the normal index back..
Well, I was only thinking that the punishments should be to have their hack made open so others could directly fix things
Reply With Quote
Reply


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 11:44 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.16916 seconds
  • Memory Usage 2,253KB
  • 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
  • (1)bbcode_php
  • (4)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
  • (8)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