The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Improve performance on thread view updating Details »» | |||||||||||||||||||||||||
Per Doc Erwin:
http://www.vbulletin.com/forum/showp...8&postcount=18 I'm releasing this here. I have a suggestion to improve performance although it is for mysql 4.04 and up (I assume at some point a future version of vb will require it). Requirements: MySQL 4.04 If you have a large forum, run mysql 4.04 and up and want to try this, please report back on your results. The way updating threads views works right now, (even though putting it in cron improved things,) you are still going through many queries to the thread table, potentially locking it up while updating views.The current code from threadviews.php is: PHP Code: PHP Code:
With 4.04 you can do a multitable update. FIRST, create the table ONCE ONLY PHP Code: PHP Code:
PHP Code: PHP Code:
That will reduce the number of queries by however many threads get updated in the cron interval. Additionally, you might be able to skip creating the extra table using subqueries. I haven't gotten around to writing that code yet. If someone wants to add that,mention it in this thread and I'll update the code. Show Your Support
|
Comments |
#22
|
||||
|
||||
For some reason, lately when I post here, the spaces get pulled out and words are stuck together. I have no idea why.
|
#23
|
|||
|
|||
I just installed this... so far so good
|
#24
|
|||
|
|||
did the edits keep getting this
Code:
Database error in vBulletin 3.0.7: 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 23rd of April 2005 03:25:03 AM Script: http://www.v3gamer.com/forums/admincp/cronadmin.php?do=runcron&cronid=2 Referer: http://www.v3gamer.com/forums/admincp/index.php? Username: admin IP Address: xx.xx.xx.xxx |
#25
|
|||
|
|||
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); |
#26
|
|||
|
|||
Hi, and first of all thank you for this release.
I was just wondering if it is normal that the "threadviewsaggregate" table remains empty ? |
#27
|
||||
|
||||
Quote:
|
#28
|
|||
|
|||
Ok, thanks for the answear
|
#29
|
||||
|
||||
How about a downloadable text file with edits @ instructions???
|
#30
|
|||
|
|||
So, is the best code in the first post, or am I supposed to use one of the other users contributions?
Also, I am running mySQL 4.0.24. Will this work with my version? Thanks! |
#31
|
|||
|
|||
Okay, I'd like to try this, but AdminCP says I don't have permission to execute queries. I tried pasting the create table stuff into the MySQL command box, but it said I needed to specify a datavase. I don't know the sytax so I couldn't.
A little help here please. |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|