Question Showthread Button Count really slow query

Status
Not open for further replies.

Zambfd

Customer
The Query for the button counter is extremly slow in larger boards.

File: hooks/showthread_query.php

The current query on line 107 takes 6-12 seconds.
600.000+ Entries in the dbtech_thanks_entry-Table.

Please change the query in further updates into the following code:
Code:
$SQL[] = '
	SELECT COUNT(*) AS count, contentid, varname
	FROM $dbtech_thanks_entry AS entry,
	   (
		SELECT postid
		FROM $post
		WHERE threadid = ' . intval($threadid) . '
			AND visible IN (1' . (!empty($deljoin) ? ",2" : "") . ($show['approvepost'] ? ",0" : "") . ')
	   ) AS t2
	WHERE entry.contenttype = \'post\'
		AND entry.varname = ' . $db->sql_prepare($button['varname']) . '
		AND contentid = t2.postid
	GROUP BY contentid
	ORDER BY count DESC
	LIMIT 5
';

.. 80-90ms


Oh, btw. the total count is still not the total count of the thread.

So how about this?
View attachment showthread_complete.txt
View attachment showthread_query.txt
 
Last edited:
Hi there,

I'll investigate your changes and merge them into the product as needed, thanks :)
 
Hello Zambfd,

This ticket has now been closed with the status Answered.

We hope your issue or question has been addressed to your satisfaction. If not, please feel free to re-open it by clicking this link.

If you have any further issues or questions, please feel free to start a new support ticket via the button at the top of every page.

Thank you!
 
Status
Not open for further replies.

Legacy Advanced Post Thanks / Like

vBulletin 3.8.x vBulletin 4.x.x
Seller
DragonByte Technologies
Release date
Last update
Total downloads
4,033
Customer rating
5.00 star(s) 1 ratings
Back
Top