Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases

Reply
 
Thread Tools
Remove 1 Database Query Per Page Details »»
Remove 1 Database Query Per Page
Version: 1.1, by Trigunflame Trigunflame is offline
Developer Last Online: Nov 2019 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 04-16-2005 Last Update: Never Installs: 18
 
No support by the author.

Remove 1 Database Query Per Page


Intro:
The idea is, lets remove 1 query from each page load, if the person is just refreshing the page. At first this may sound not important or just plain stupid, but on "larger" forums, cutting 1 query is always welcomed I know.

Description:
Basically all this does, is check the current Session Location from the DB against the current WOL path; the Session is already provided by vbulletin, so no extra query there.

All we do, is simply check the Location from the Database against the current WOL, if they don't match then the query is allowed to update the database; if they are the same - it is simply ignored.

Affects:
The only things this will do, is prevent the updating of the "lastactivity", and "location" if a person keeps refreshing the page, IMO that's not really a big deal, vbulletin takes care of deleting and remaking new sessions when they expire anyway. As long as your members are browsing around and such, their lastactivity, location will be updated as per usual.

Updates:
Version 1.1 - Scripts whosonline, misc are allowed to always update.
Version 1.0 - Release

Instructions:
1. [ open includes/sessions.php ]
2. [ go to about line 354, or look for $bypass = intval(SESSION_BYPASS); ]
3. [ replace this block of code ]

PHP Code:
    $DB_site->shutdown_query("
        UPDATE " 
TABLE_PREFIX "session
        SET useragent = '" 
addslashes(USER_AGENT) . "', lastactivity = " TIMENOW $location ", styleid = $styleidiif(VB_AREA !== 'Upgrade'", bypass = $bypass") . "
        ###REPLACE###
        WHERE sessionhash = '" 
addslashes($session['sessionhash']) . "'"
        
'sessionupdate'
); 
4. [ with this block of code]

PHP Code:
    /**
     * Update Location On Page Change
     *
     * @author Trigunflame
     * @version 1.1
     * @copyright Dusty Burns 2005-2006
     */

    // Check Script
    
if ($session['location'] != WOLPATH || THIS_SCRIPT == 'misc' || THIS_SCRIPT == 'online')
    {
        
$DB_site->shutdown_query("
            UPDATE " 
TABLE_PREFIX "session
            SET useragent = '" 
addslashes(USER_AGENT) . "', lastactivity = " TIMENOW $location ", styleid = $styleidiif(VB_AREA !== 'Upgrade'", bypass = $bypass") . "
             ###REPLACE###
             WHERE sessionhash = '" 
addslashes($session['sessionhash']) . "'"
            
'sessionupdate'
        
);
    }

    
/**
     * End Update Locations On Page Change
     */ 
5. [ save file ]

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 04-17-2005, 04:49 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i'll probably install but i'm happy with my vote for MAF thank you
Reply With Quote
  #3  
Old 04-17-2005, 05:09 PM
Trigunflame's Avatar
Trigunflame Trigunflame is offline
 
Join Date: Aug 2002
Posts: 742
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sabret00the
i'll probably install but i'm happy with my vote for MAF thank you
lol, poo on you
Reply With Quote
  #4  
Old 04-17-2005, 06:07 PM
Princeton's Avatar
Princeton Princeton is offline
 
Join Date: Nov 2001
Location: Vineland, NJ
Posts: 6,693
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anything that improves overall performance is a PLUS ...
Reply With Quote
  #5  
Old 04-17-2005, 06:17 PM
Trigunflame's Avatar
Trigunflame Trigunflame is offline
 
Join Date: Aug 2002
Posts: 742
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by princeton
anything that improves overall performance is a PLUS ...
Couldn't agree more XD
Reply With Quote
  #6  
Old 04-17-2005, 06:45 PM
nexialys
Guest
 
Posts: n/a
Default

i would like to see a single forum where we can post that kind of Performance hack, because there is some (*i can count at least 25 of these), and they would be more than interesting to add to the next update...

because they are not hacks, they are debugs (when we don't modify a function, it's a debug isn't it?)
Reply With Quote
  #7  
Old 04-17-2005, 06:56 PM
Trigunflame's Avatar
Trigunflame Trigunflame is offline
 
Join Date: Aug 2002
Posts: 742
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by nexialys
i would like to see a single forum where we can post that kind of Performance hack, because there is some (*i can count at least 25 of these), and they would be more than interesting to add to the next update...

because they are not hacks, they are debugs (when we don't modify a function, it's a debug isn't it?)
I imagine, I woulda stuck this in mini-mods, but eh it really belongs here, if anywhere :/
Reply With Quote
  #8  
Old 04-17-2005, 07:53 PM
Yami Shadow Yami Shadow is offline
 
Join Date: Feb 2005
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I like this, but it seems to increase my board's query by 1, rather than knocking one off. Originally had 10, went to 11 after I preformed the mod..
Reply With Quote
  #9  
Old 04-17-2005, 07:55 PM
Trigunflame's Avatar
Trigunflame Trigunflame is offline
 
Join Date: Aug 2002
Posts: 742
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Yami Shadow
I like this, but it seems to increase my board's query by 1, rather than knocking one off. Originally had 10, went to 11 after I preformed the mod..
Eh, thats not possible. Make sure you copied it exactly as I have it.

All this is doing is an IF condition to check the current page, if its the same page then the query is ignored.

Also should note: These are "Shutdown queries" which are performed after the output of data to the forum, and that would include whatever hack you are using to count queries.

These queries are not "counted" by traditional means, they are executed at the end of the life of the script.
Reply With Quote
  #10  
Old 04-18-2005, 10:38 AM
T3MEDIA T3MEDIA is offline
 
Join Date: Dec 2004
Posts: 944
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hummm how are you guys checking your queries? via putty or something?
Reply With Quote
Reply

Thread Tools

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 10:29 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.08602 seconds
  • Memory Usage 2,303KB
  • Queries Executed 23 (?)
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
  • (2)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (9)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