Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
JEFF MACK Posted April 3, 2016 Posted April 3, 2016 Is there a core table that counts and stores numbers like Member Count, Post Count, Topic Count?
JEFF MACK Posted April 4, 2016 Author Posted April 4, 2016 Any ideas or is this just queried on the fly every time?
Adriano Faria Posted April 4, 2016 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();
dal Posted May 26, 2016 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 ?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.