tamriel-foundry / apocrypha

Theme files for Tamriel Foundry
2 stars 1 forks source link

Store post counts in usermeta to prevent duplicate COUNTs in SQL #2

Closed aaclayton closed 11 years ago

aaclayton commented 11 years ago

Post counting has been a "pending" feature in bbPress development for several milestones now. I'm no longer confident they are going to handle this internally, plus, I want to include comments and front page articles in the "post count" as well.

Instead of running a COUNT query to get a "live" post count for each user, let's save the count in the usermeta table and update it for that user when a new post is created or a post is deleted.

aaclayton commented 11 years ago

I implemented a first patch of this, works well so far for article comments. I need to include base articles themselves, and make sure it's working for forum posts once I add bbPress components.

aaclayton commented 11 years ago

I think I've got this taken care of now. Instead of running a COUNT in the posts table, I'm just doing a simple lookup in the usermeta table. Should be a win for performance.