vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Improve performance on thread view updating (https://vborg.vbsupport.ru/showthread.php?t=78232)

Marco van Herwaarden 05-08-2005 09:03 AM

To run a query in your ACP, you must add your userid to the canrunquery variable in your config.php

dsboyce8624 05-08-2005 01:31 PM

And this is the correct code?

Quote:

Originally Posted by tp214
nevermind!

this is the correct code...

Code:

error_reporting(E_ALL & ~E_NOTICE);

if (!is_object($DB_site))
{
        exit;
}

$DB_site->query("INSERT INTO ". TABLE_PREFIX ."threadviewsaggregate SELECT threadid , COUNT(*) AS views FROM " . TABLE_PREFIX . "threadviews GROUP BY threadid");
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "threadviews");

$DB_site->query(
        "UPDATE " . TABLE_PREFIX . "thread,". TABLE_PREFIX ."threadviewsaggregate
        SET ". TABLE_PREFIX ."thread.views = ". TABLE_PREFIX ."thread.views + ".TABLE_PREFIX."threadviewsaggregate.views
        WHERE ". TABLE_PREFIX ."thread.threadid = ". TABLE_PREFIX ."threadviewsaggregate.threadid");
$DB_site->query("DELETE FROM ". TABLE_PREFIX ."threadviewsaggregate");

log_cron_action('Thread Views Updated', $nextitem);



dsboyce8624 05-08-2005 01:39 PM

Okay, I put that code in and turned on logging. It says it ran fine.

Thanks for the help.

GlitterKill 05-21-2005 04:02 PM

Quote:

Originally Posted by detalhe
Installed this and got this error after sometime:

PHP Code:

Database error in vBulletin 3.0.6:
 
Invalid SQLINSERTINTOthreadviewsaggregate SELECT threadid COUNT(*)ASviewsFROM threadviews GROUP BY threadid
mysql error
You have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERTINTOthreadviewsaggregate SELECT threadid , COUNT(*)ASviews
 
mysql error number: 1064 

Will uninstall :disappointed:

I have used the most recent posted code that is supposed to be good but I get this type of error every hour:

Database error in vBulletin 3.0.6:

Invalid SQL: INSERTINTOthreadviewsaggregate SELECT threadid , COUNT(*)ASviewsFROM threadviews GROUP BY threadid mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERTINTOthreadviewsaggregate SELECT threadid , COUNT(*)ASview

mysql error number: 1064

Date: Saturday 21st of May 2005 10:56:17 AM
Script: http://forums.pimprig.com/cron.php?&rand=634959
Referer: http://gallery.pimprig.com/showphoto...o=2553&cat=501
Username: Unregistered
IP Address: 86.133.1.23

Marco van Herwaarden 05-23-2005 09:14 AM

Insert spaces where needed. The code in this thread is somehow missing some spaces.

Edit: Edited the original code now with spaces inserted.

kmike 05-23-2005 10:25 AM

Took long enough...
But not all occurences are updated:
Code:

query("SELECTthreadid ,

Marco van Herwaarden 05-23-2005 11:11 AM

Quote:

Originally Posted by kmike
Took long enough...

There was no reason at all for that remark, especially since the corrections are already posted in this thread (and it is not a 50 page thread).

Quote:

Originally Posted by kmike
But not all occurences are updated:

Thanks fixed.

kmike 05-23-2005 12:57 PM

Sorry, I thought you're author of this hack but I see my mistake now.

David Bott 05-25-2005 07:03 PM

Installed on AVS Forum.

WotC_Mel 06-17-2005 05:26 PM

I see this has been installed successfully a few places. Anyone willing to comment on performance improvements they've notice?

-Mel


All times are GMT. The time now is 04:50 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.01159 seconds
  • Memory Usage 1,740KB
  • 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
  • (1)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (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