Skip to content

Performance: optimize subscriber database queries - #1318

Merged
danieliser merged 1 commit into
developfrom
agent/subscriber-query-perf
Aug 13, 2026
Merged

Performance: optimize subscriber database queries#1318
danieliser merged 1 commit into
developfrom
agent/subscriber-query-perf

Conversation

@danieliser

@danieliser danieliser commented Aug 10, 2026

Copy link
Copy Markdown
Member

Scope

Standalone performance change against develop for subscriber database reads and WordPress privacy lookups.

TL;DR

Moves subscriber pagination totals from full-row hydration to COUNT(*), and routes WordPress privacy export/erase through the existing indexed email column rather than a broad substring scan across every subscriber field.

Measurement method

MySQL 8.0.35 / PHP 8.3, 100,000-row temporary copy of the real pum_subscribers schema and indexes. Temporary tables were session-scoped and left the site database unchanged. Timing used 12 warm alternating samples; memory used isolated processes so the full-row baseline did not contaminate the count measurement.

Operation Before After Gain
Pagination count retained PHP memory 195,016,736 B 16,472 B -195,000,264 B (-99.99%)
Pagination count elapsed (isolated sample) 199.45 ms 128.50 ms -35.6%
Privacy lookup median 225.95 ms 0.20 ms ~1,159x faster
Privacy lookup query plan full scan, ~100,102 rows email index, 1 row indexed point lookup

The count timing is storage-engine dependent; the primary deterministic gain is that PHP no longer transfers, allocates, and retains every matching row merely to count them.

Compatibility

  • Free-text subscriber search is unchanged and still searches the selected fields.
  • Pagination, ordering, selected fields, and return formats are unchanged.
  • Privacy export/erase already accepted only strict email matches after querying; the database now applies that same exact predicate first.
  • Exact filters are limited to declared subscriber columns and use their existing prepared value formats.

Validation

  • Full GitHub Tests matrix and CI - Code Quality: green on the final SHA.
  • Focused subscriber suite: 59 tests, 128 assertions.
  • Changed production-file PHPCS at CI error severity: passed.
  • PHP syntax and git diff --check: passed.
  • Original scoped commit replayed unchanged onto current develop (git range-diff exact match).

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@danieliser, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 6 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: da69888e-2f42-4f89-b959-c3e5c310db69

📥 Commits

Reviewing files that changed from the base of the PR and between 876b6de and 6716233.

📒 Files selected for processing (3)
  • classes/DB/Subscribers.php
  • classes/Privacy.php
  • tests/php/tests/PUM_DB_Subscribers_Test.php

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@danieliser
danieliser force-pushed the agent/php-popup-editor-perf branch from 0ddbaef to 5d7304e Compare August 12, 2026 07:38
@danieliser
danieliser force-pushed the agent/subscriber-query-perf branch 2 times, most recently from 4f6c60c to 451693e Compare August 13, 2026 01:55
@danieliser
danieliser changed the base branch from agent/php-popup-editor-perf to develop August 13, 2026 01:55
@danieliser
danieliser force-pushed the agent/subscriber-query-perf branch from 9a39ab3 to 451693e Compare August 13, 2026 01:57
@danieliser

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 451693e5b1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danieliser
danieliser force-pushed the agent/subscriber-query-perf branch from faae925 to 5efe5f5 Compare August 13, 2026 02:38
@danieliser

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 5efe5f55f4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danieliser
danieliser force-pushed the agent/subscriber-query-perf branch from a693248 to 6716233 Compare August 13, 2026 10:23
@danieliser

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 6716233cd8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danieliser
danieliser merged commit 676bad9 into develop Aug 13, 2026
27 checks passed
@danieliser
danieliser deleted the agent/subscriber-query-perf branch August 13, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant