Previous Thread
Next Thread
Print Thread
Hop To
Joined: Feb 2004
Posts: 4
M
stranger
stranger
M Offline
Joined: Feb 2004
Posts: 4
I'm operating a very active UBB.threads board with dozens of forums that date back at least five years. The message database has become so huge that the Linux server is starting to bog down and users are complaining of slow responses, particularly accessing the main index page. I'd like to be able to "age off" the messages older than a year or so in order to help reduce the CPU overhead and improve speed, but I'm not sure how to accomplish this without getting the various UBB.threads tables out of sync. Can anyone advise on how to do this.

I tried the "debug=1" trick and it looks like most of the slowness is due to processing queries against the w3t_Posts table with queries like:

SELECT COUNT(*) , SUM(B_Topic) FROM w3t_Posts WHERE ( (B_Posted > 0 AND B_Posted <> 4294967295) OR (B_Posted = 4294967295 AND B_Sticky > 0) ) AND B_Board = 'cessna182'

Processing the main index page involves one of these queries for each board, and some of the queries are taking close to 10 seconds each!

I'm wondering whether adding an INDEX for the B_Posted and B_Sticky fields of the w3t_Posts table would improve this situation?

If it matters, this server is presently running a somewhat outdated version of UBB.threads (6.1.1). I've been meaning to upgrade to the latest version, but unfortunately that's somewhat non-trivial to do since the system has several non-standard software patches in order to integrate it into a pre-existing database of authorized users.

Out of curiousity, would upgrading to the latest version of UBB.threads have any significant impact on the performance problems I'm seeing?

Last edited by Mike Busch; 02/03/2004 1:03 PM.
Joined: Feb 2004
Posts: 4
M
stranger
stranger
M Offline
Joined: Feb 2004
Posts: 4
I've temporarily resolved most of the slowness in the main index page by disabling the display of new thread and new post counts. However, I still suspect that the ultimate solution to the performance problem must be archiving of old posts so that the active w3t_Posts table is back to a more reasonable size.

Joined: Jan 2004
Posts: 74
G
journeyman
journeyman
G Offline
Joined: Jan 2004
Posts: 74
In your “Admin” section, go to “Edit or delete a forum”. You can find this in the “Forum Management” table, which is the third one from the top. After you select the forum you would like to prune, you will see a box that says, “Expire threads after how many days (0 - Never Expire)” You can then enter an expiration time. For example, if you enter “7” (without the quotes), then the server will delete all threads that no one has posted to in the past 7 days.

In order for this to work, however, you have to either setup a cron task for your doexpire.php file, or run it daily in your browser. The file is located in your cron/php folder. Instructions in setting up cron tasks can be found in the “Docs” link in the navigation bar here to the left.


Visit the real Threadsdev at http://www.threadsdev.net
Joined: Feb 2004
Posts: 4
M
stranger
stranger
M Offline
Joined: Feb 2004
Posts: 4
Thanks, DL. Now, is it possible somehow to age off inactive threads into some sort of "archive foums" so that they're still available for searching yet don't clutter up the active forums? Or is that asking too much?

Joined: Dec 2003
Posts: 613
Likes: 6
Former Developer
Former Developer
Joined: Dec 2003
Posts: 613
Likes: 6
For that, you'll need the mass move tool that's built into the next release, 6.5 <img src="https://www.ubbcentral.com/boards/images/graemlins/smile.gif" alt="" />


Charles Capps
Former UBB.classic Maintainer
Joined: Jan 2004
Posts: 74
G
journeyman
journeyman
G Offline
Joined: Jan 2004
Posts: 74
I actually utilise a small hack that I came up with for that very reason. In my cron/php/doexpire.php file I changed:

Code
        $query = "
           DELETE FROM {$config['tbprefix']}Posts
           WHERE B_Main  = '$Mnumber'
           AND   B_Board = '$Keyword_q'
        ";
        $rc = $dbh -&gt; do_query($query);

to this:

Code
        $query = "
           UPDATE {$config['tbprefix']}Posts
           SET B_Board = 'trash' 
           WHERE B_Main = '$Mnumber'
           AND   B_Board = '$Keyword_q'
           AND   B_Board != 'UBB62'
        ";

        $rc = $dbh -&gt; do_query($query);

'trash' is the keyword for my archive forum. I excluded the UBB62 forum because this in an off-topic forum, and I wanted those to be deleted. You can leave that line out if you want everything moved and none deleted. However, to have old posts in UBB62 deleted, I inserted:

Code
        $query = "
           DELETE FROM {$config['tbprefix']}Posts
           WHERE B_Board = 'UBB62' 
           AND   B_Main = '$Mnumber'
        ";

        $rc = $dbh -&gt; do_query($query);


Visit the real Threadsdev at http://www.threadsdev.net
Joined: Jun 2006
Posts: 742
enthusiast
enthusiast
Joined: Jun 2006
Posts: 742
You'd probably also need to update the number of posts in the w3t_Boards table - or else the pagination would be off. I think the check post count utility at ThreadsDev will do that.


Joshua Pettit
Web Developer
www.ThreadsDev.net | www.JoshuaPettit.com
Joined: Jan 2004
Posts: 74
G
journeyman
journeyman
G Offline
Joined: Jan 2004
Posts: 74
I guess I took for granted that I run that as a daily cron too. <img src="https://www.ubbcentral.com/boards/images/graemlins/smile.gif" alt="" />


Visit the real Threadsdev at http://www.threadsdev.net
Joined: Feb 2004
Posts: 4
M
stranger
stranger
M Offline
Joined: Feb 2004
Posts: 4
This is great stuff! Exactly what I needed to know. Thanks, guys!!! <img src="https://www.ubbcentral.com/boards/images/graemlins/grin.gif" alt="" />


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Having issues going from 7.5.5. to 8X
by Mors - 10/22/2026 5:32 PM
Slow Queries - Any Ideas?
by BellaOnline - 10/16/2026 8:34 PM
Selling a Forum?
by ECNet - 10/10/2026 2:54 PM
Who's Online Now
1 members (1 invisible), 566 guests, and 272 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Ride safe!
Ride safe!
by Morgan, December 7
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20261026)