Blog Post

GD bbPress Toolbox Pro 4.3.5

GD bbPress Toolbox Pro 4.3.5 is a new minor release that deals with a very interesting performance issue related to a function and SQL query for getting the latest posts for some views and widget.

The issue by itself is not too problematic because it will cause problems only in some rare cases: some versions of MySQL and very large database (millions of posts), but regardless, it is important to be fixed for future proofing plugin against performance issues.

But, it is interesting to point out what exactly happens. The plugin uses an SQL query to get posts for the latest posts widget. This query is quite simple:

SELECT ID, post_type, post_parent, post_author FROM wp_posts
WHERE post_type in (‘topic’, ‘reply’) AND post_status in (‘publish’, ‘closed’)
AND post_date_gmt > ‘2016-09-12 12:00:00’
ORDER BY ID DESC LIMIT 0, 1000

It uses post_date_gmt column because the date we want to check against is derived from PHP time() function returning GMT timestamp. So, why not to use WordPress own column to check, right? Wrong. The column post_date_gmt,while holding GMT version of post_date, is useless for any kind of WHERE or JOIN use because it is not indexed. Column post_date is indexed along with the post_type, post_status, and ID, and any query involving these columns will be fast. Add post_date_gmt, and on a large database, this query will be very slow.

There is a 6 years old ticket on WordPress.org to add an index to GMT column too, but as of yet, that has not happened. So, to avoid potential performance problems, the plugin will revert to use post_date column, but the timestamp will be modified with system timezone value before use.

I would like to thank Jan de Sousa from Daily Rush for reporting the issue and taking the time to help me debug and track the problem.

If you notice any problems with the plugin, stop by the support forums to report it. Let me know what you think about the new version, and as always, suggestions are welcome.

Please wait...
forumToolbox Pro WordPress Plugin
Enhance, expand and optimize bbPress powered forums

Expand bbPress powered forums with attachments upload, BBCodes support, signatures, widgets, quotes, toolbar menu, activity tracking, enhanced widgets, extra views...

About the author

Milan Petrovic
Milan Petrovic

CEO and Lead developer of Dev4Press Web Development company, working with WordPress since 2008, first as a freelancer, later founding own development company. Author of more than 250 plugins and more than 20 themes.

Leave a Comment

Latest From The Blog

plugins release forum toolbox for bbpress 8.0

forumToolbox for bbPress 8.0

We are thrilled to announce the official release of forumToolbox Pro 8.0! This release marks a major evolution, focusing on modernizing core workflows, stripping out legacy technical debt, and introducing new attachments upload interface reimagined from ground up.
plugins release sweeppress pro lite 7

SweepPress 7.0 Pro & Lite

SweepPress, version 7.0 (both Lite and Pro), is a major update that brings one new management tool for managing attachments in media library, new shared library, new Freemius SDK, various improvements and fixes.
announcement pricing changes

Changes to the plugins pricing

Dev4Press plugins switched to use Freemius in January of 2025, and to make things simpler, the new pricing model remained as it was before that. We have now decided to update the pricing model.

0
0
0
0
0
0
0
0
0