JEFF MACK Posted April 3, 2016 Share Posted April 3, 2016 Is there a core table that counts and stores numbers like Member Count, Post Count, Topic Count? Link to comment Share on other sites More sharing options...
JEFF MACK Posted April 4, 2016 Author Share Posted April 4, 2016 Any ideas or is this just queried on the fly every time? Link to comment Share on other sites More sharing options...
Adriano Faria Posted April 4, 2016 Share Posted April 4, 2016 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 More sharing options...
dal Posted May 26, 2016 Share Posted May 26, 2016 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.