Skip to:
Content

bbPress.org

Opened 13 years ago

Last modified 2 months ago

#2533 new enhancement

Optimize Repair Tools SQL Queries

Reported by: netweb Owned by: netweb
Priority: normal Milestone: 2.7
Component: Tools Version: 2.5
Severity: normal Keywords: needs-unit-tests needs-refresh
Cc:

Description

Optimize Repair Tools SQL Queries | bbPress -> Tools - Repair Tools

Attachments (3)

2533.1.diff​ (3.5 KB ) - added by netweb 13 years ago.
2533.2.diff​ (3.8 KB ) - added by netweb 13 years ago.
Patch for _bbp_last_active_id & _bbp_last_active_time
2533.3.diff​ (4.2 KB ) - added by netweb 13 years ago.

Download all attachments as: .zip

Change History (25)

#1 @netweb
13 years ago

  • Keywords needs-testing added

In ​2533.1.diff

Combine existing two SQL queries to a single SQL query for Topics _bbp_last_active_id

Query times based on ~2,500 Topics with ~5,000 replies total ~33% performance increase

Original queries total time - Total Query Time: 180.5ms (Part 1 - 92.1ms & Part 2 88.4ms)

New single query - Total Query Time: 119.0ms*/

Last edited 13 years ago by netweb (previous) (diff)

@netweb
13 years ago

Patch for _bbp_last_active_id & _bbp_last_active_time

#2 @netweb
13 years ago

In ​2533.2.diff added _bbp_last_active_time

Combine existing two SQL queries to a single SQL query for Topics _bbp_last_active_time

Query times based on ~2,500 Topics with ~5,000 replies total ~50% performance increase

Original queries total time - Total Query Time: 95.3ms (Part 1 - 43.9ms & Part 2 51.4ms)

New single query - Total Query Time: 44.5ms*/

#3 @netweb
13 years ago

In ​2533.3.diff
Fix bbp_admin_repair_topic_voice_count() where the count was including the reply custom post type, causing SQL errors and terminating the function early before the count was completed.

#4 @netweb
13 years ago

Related: #2353

#5 @netweb
13 years ago

  • Milestone Awaiting Review → 2.6

Moving to 2.6, irrespective of how #1925 is implemented this is good to go.

This ticket was mentioned in IRC in #bbpress-dev by netweb. ​View the logs.


13 years ago

#7 @netweb
12 years ago

  • Owner set to netweb

This ticket was mentioned in IRC in #bbpress-dev by netweb. ​View the logs.


12 years ago

#9 @netweb
12 years ago

  • Keywords needs-unit-tests added; needs-testing removed

We should be including bbp_update_topic_anonymous_reply_count() in the repair tool counts.

Will update patch with unit tests ;)

#10 @netweb
11 years ago

In 5831:

Tests: Add admin tools test test_bbp_admin_repair_topic_voice_count() for bbp_admin_repair_topic_voice_count()

Props netweb. See #2533

This ticket was mentioned in ​Slack in #bbpress by netweb. ​View the logs.


11 years ago

#12 @netweb
11 years ago

Related: #2876

This ticket was mentioned in ​Slack in #bbpress by netweb. ​View the logs.


11 years ago

#14 follow-up: @Destac
10 years ago

Is there anything left that needs to be done in this ticket other than testing?

#15 in reply to: ↑ 14 ; follow-up: @netweb
10 years ago

Replying to Destac:

Is there anything left that needs to be done in this ticket other than testing?

Yes, the unit test test_bbp_admin_repair_freshness() for bbp_admin_repair_freshness() needs to be created before merging the outstanding patch in 2533.3.diff​

#16 in reply to: ↑ 15 ; follow-up: @Destac
10 years ago

What's the procedure to help with testing i would love to help

#17 in reply to: ↑ 16 @netweb
10 years ago

Replying to Destac:

What's the procedure to help with testing i would love to help

For this ticket, PHPUnit, it's outlined in the WordPress core handbook:

​https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/

If this is something you're familiar with then some help would be fantastic.

We also have what we call "Good First Bugs" that are great introductions to contributing, these bugs are a great way to get started, you can see a list of the "open tickets" here: ​https://bbpress.trac.wordpress.org/query?status=!closed&keywords=~good-first-bug

#18 @johnjamesjacoby
10 years ago

We aren't actually using _bbp_anonymous_reply_count anywhere. Maybe we don't have to?

#19 @johnjamesjacoby
10 years ago

  • Milestone 2.6 → 2.7

Bump to 2.7. What's in is good, and what's left doesn't appear critical.

#20 @netweb
10 years ago

  • Keywords needs-refresh added

Patch will need a refresh and unit tests, adding some refreshed performance stats would also be nice

#21 @johnjamesjacoby
2 months ago

In 7453:

Counts: improve repair and subforum integrity.

Count public, private, and hidden subforums from the post hierarchy, and synchronize parent counts when forums change visibility, parent, post type, or are permanently deleted. Keep child relationship metadata aligned when WordPress reparents forums.

Correct count repair queries to target bbPress post types, honor filtered statuses, exclude anonymous authors, preserve unrelated metadata, repair empty user counts, clear metadata caches after direct database writes, and detect database failures from wpdb return values.

In trunk, for 2.7.

Props netweb, GDragoN.
Fixes #2649.
Fixes #2664.
See #2533, #2586, #3678.

#22 @johnjamesjacoby
2 months ago

In 7454:

Counts: improve repair and subforum integrity.

Count public, private, and hidden subforums from the post hierarchy, and synchronize parent counts when forums change visibility, parent, post type, or are permanently deleted. Keep child relationship metadata aligned when WordPress reparents forums.

Correct count repair queries to target bbPress post types, honor filtered statuses, exclude anonymous authors, preserve unrelated metadata, repair empty user counts, clear metadata caches after direct database writes, and detect database failures from wpdb return values.

Merges r7453 to 2.6.

In 2.6, for 2.6.16.

See #2533, #2586, #2649, #2664, #3678.

Note: See TracTickets for help on using tickets.