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:
	
	
	
		
.. 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
				
			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: