Jump to content

Is there a table that stores forum counts?


Recommended Posts

Queries are on widgets and they are updated at every 60 seconds (or more, depending on your setting). Forums stats, for example:

		$stats = array();
		$stats['total_posts']	= \IPS\Db::i()->select( "COUNT(*)", 'forums_posts', array( 'queued = ?', 0 ) )->first();
		if ( \IPS\Settings::i()->archive_on )
			$stats['total_posts'] += \IPS\forums\Topic\ArchivedPost::db()->select( 'COUNT(*)', 'forums_archive_posts', array( 'archive_queued = ?', 0 ) )->first();
		$stats['total_topics']	= \IPS\Db::i()->select( "COUNT(*)", 'forums_topics', array( 'approved = ?', 1 ) )->first();


Link to comment
Share on other sites

  • 1 month later...

I've tried using these queries to acquire the forum stats for use on another page of the site however the query that counts the total number of posts started to queue up in the database server almost immediately and ground the site to a halt - it's simply too resource intensive to keep recounting such a large table. 

Is there nowhere in the database where these forum statistics are cached ? 

Surely the forum doesn't recount them every time someone views the forum stats widget ?

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...