vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Major Additions - iTrader v2.8 - Powerful Rating System (https://vborg.vbsupport.ru/showthread.php?t=232044)

digitalpoint 04-23-2010 10:45 PM

The indexes defined in the iTrader table are not scalable at ALL. It's causing full table scans for queries and joins done when you are looking at iTrader stuff for any user. This was causing our user table to have locking issues since those queries are joined to the user table, which in turn causes everything in the forum to slow down (even if it has nothing to do with iTrader).

1. The index rateid index has no need for it to include the dateline column in the index.

2. The index rateduserid is an exact duplicate of the rateid index. This index should include rateduserid and dateline columns (it incorrectly includes rateid and dateline).

3. An index for rateduserid + buyselltrade columns is needed.

I've made those changes to our itrader table and now our itrader table (which has 526,000+ iTrader ratings) does not cause issues any longer.

This is what our indexes look like now:

http://img197.imageshack.us/img197/1903/screenfr.png

Hopefully we will see index fixes in a future version of iTrader package? :)

Manoel J?nior 04-24-2010 02:57 AM

Great question digitalpoint!

entertain 04-24-2010 07:30 AM

@digitalpoint:
I didn't want to change the database structure, because maybe vbenhancer is going to release v3 with the old structures and this would make an update to v3 very, very difficult. :(

sevenmix 04-26-2010 02:40 AM

Hi

First of all thanks to keep updating this awesome plugin.

My question: Is there any way to keep the rate seller button on every post and not only the first one?

Thanks in advance, greetings.

entertain 04-26-2010 12:44 PM

@sevenmix:
Admin CP -> Plugins & Products -> Plugin Manager

Edit plug-in: iTrader Navbar Link (postbit_display_complete)

Search for:
PHP Code:

    if (in_array($this->forum['forumid'], $itrader_forumsurl_ok) AND $this->registry->options['itrader_rate_trade'] AND $this->registry->bf_ugp['itraderpermissions']['canrate'] AND $vbulletin->userinfo['userid'] != $thread[postuserid] AND $this->post['postid'] == $this->thread['firstpostid']) 

change into
PHP Code:

    if (in_array($this->forum['forumid'], $itrader_forumsurl_ok) AND $this->registry->options['itrader_rate_trade'] AND $this->registry->bf_ugp['itraderpermissions']['canrate'] AND $vbulletin->userinfo['userid'] != $thread[postuserid]) 

(untested ;))

sevenmix 04-26-2010 03:00 PM

Thanks very much entertain, that works perfectly :)

Retal 04-29-2010 01:15 PM

Hello, the links under usernames on the page "Left for others" lead to the iTrader page of the user who left the rating, not the user who was rated.

Solution

itrader.php
Change
PHP Code:

        $templater vB_Template::create('itrader_userbits');
            
$templater->register('itrader'$itrader);
            
$templater->register('userinfo'$userinfo);
        
$itrader_userbits .= $templater->render(); 

to
PHP Code:

        $templater vB_Template::create('itrader_userbits');
            
$templater->register('itrader'$itrader);
            
$templater->register('userinfo'$userinfo);
            
$templater->register('viewuser'$viewuser);
        
$itrader_userbits .= $templater->render(); 

Template itrader_userbits
Change
HTML Code:

<a href="{vb:raw vboptions.bburl}/itrader.php?{vb:raw session.sessionurl}u={vb:raw itrader.userid}">{vb:raw itrader.username}</a>(<strong>{vb:raw itrader.itrader_total}</strong>)
to
HTML Code:

<a href="{vb:raw vboptions.bburl}/itrader.php?{vb:raw session.sessionurl}u=<vb:if condition="$viewuser['viewtype'] == 4">{vb:raw itrader.rateduserid}<vb:else />{vb:raw itrader.userid}</vb:if>">{vb:raw itrader.username}</a> (<strong>{vb:raw itrader.itrader_total}</strong>)

sung 04-30-2010 05:33 PM

Quote:

Originally Posted by entertain (Post 2026365)
@digitalpoint:
I didn't want to change the database structure, because maybe vbenhancer is going to release v3 with the old structures and this would make an update to v3 very, very difficult. :(

If he was changing the table schema you'd be correct, however changing the indexes won't have any effect on that since you can just rebuild them.

To make his changes you'd just put the following queries in the install/upgrade code:

Code:

alter table itrader drop index rateid;
alter table itrader drop index rateduserid;
alter table itrader add index rateid (rateid);
alter table itrader add index rateduserid (rateduserid, dateline);
alter table itrader add index rateduserid2 (rateduserid, buyselltrade);


And to go back to the previous indexes:

Code:

alter table itrader drop index rateid;
alter table itrader drop index rateduserid;
alter table itrader drop index rateduserid2;
alter table itrader add index rateid (rateid, dateline);
alter table itrader add index rateduserid (rateid, dateline);


Unless you have some inside knowledge about a 3.x release, no sense in making the current version slower for no reason.

entertain 04-30-2010 08:14 PM

@sung:
Thanks! Is it possible that itrader_main became very slow after these changes?

(Taking around 2-3 seconds to load, all other (itrader) pages around 0,05 to 0,10 seconds)

KevinAlthaus 05-01-2010 09:02 PM

Is this version fully working in vb 4.0?


All times are GMT. The time now is 01:24 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.02022 seconds
  • Memory Usage 1,764KB
  • 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
  • (2)bbcode_code_printable
  • (2)bbcode_html_printable
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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