Skip to content

perf: queue-tuning and post-identity schema probes cost ~11 queries per request #3711

Open

Description

@chubes4

Problem

After #3708, these schema probes still run on every request, on every site:

  • datamachine_initialize_queue_tuning → GroupRegistrar::tablesExist() → Action Scheduler tables_exist(): 4 queries. GroupRegistrar::ensureDataMachineGroup → ensureCustomTableGroup (table check plus group SELECT): 2 queries.
  • datamachine_maybe_install_post_identity_reservations (plugins_loaded 5) runs PostIdentityReservations->validate_schema() (SHOW TABLES, SHOW COLUMNS, SHOW INDEX) before checking the datamachine_post_identity_reservations_schema option: 5 queries.

Desired state

  • Both probes are gated by stored state, so a steady-state request does no schema queries:
    • the queue-tuning probes, once the AS tables and the Data Machine group are confirmed;
    • the reservations install, by checking the stored schema version first.
  • Safety is preserved. Reservation writes already fail closed (Make post identity reservations crash-safe #2972). Keep that guarantee by revalidating, and clearing the option, when a reservation write hits a missing table or column, rather than revalidating on every request. Document the reasoning in the PR.
  • Tests cover the gated no-op path, first install, and recovery after the table disappears.

Measured with a read-only full-page render profile on production (SAVEQUERIES, Redis object cache warm; tracking in Extra-Chill/extrachill#428). Follow-up to #3708 (PR #3709), which removes the 96-query ensure_all_tables() convergence; these are the next-largest per-request query sources.

🤖 Extra Chill Bot

Activity

  1. chubes4 commented on Oct 31, 2026

    @chubes4
    MemberAuthor

    Partly fixed by #3714, which removes 7 of the queries: the AS group probe and the post-identity schema validation.

    Still open: QueueTuning runs GroupRegistrar::tablesExist() live (4 SHOW TABLES LIKE queries through AS's StoreSchema and LoggerSchema). Caching it would break the action-scheduler-multisite-smoke contract, which requires a schema that disappears to unhook the runner at the next action_scheduler_init. The remaining win is one SHOW TABLES LIKE '{prefix}actionscheduler\_%' query checked against the 4 expected names. That needs the legacy multisite fixture's get_col stub to support the wildcard, and that fixture has pre-existing PHPCS errors.

    🤖 Extra Chill Bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions