noCV
PQUERY-105 · Change the expensive paths

Evaluate a partial index for open work without slowing closure updates

Practice briefTaskAdvanced

Only a small fraction of work orders remain open. A broad index makes the open inbox faster but adds substantial storage and maintenance cost.

Focused work estimate
4h + prerequisites
Priority in the scenario
High
Engineering practice
Indexing · Read/write tradeoffs

Estimated field mix

  • Database engineering50%
  • Performance engineering50%

Field percentages are editorial estimates of the ticket's engineering focus. They total 100%; they are not measured time, proficiency scores, or ownership evidence.

Your next step

Review it, then add it to your workspace.

The board opens an editable draft; nothing is saved until you confirm it. Sign-in and workspace permissions apply, and Demo boards remain ephemeral.

Project context

A fictional maintenance service lists open work orders beside years of closed history. A query that was cheap in a small demo now scans far more rows than it returns. Recreate the schema and synthetic workload locally; no customer database or supplied fixture is assumed.

Setup prerequisites

  • Create an isolated local database with tenants, work orders and assignment history.
  • Seed 200,000 synthetic work orders with documented skew and a repeatable random seed; record PostgreSQL version, settings and resource limits.

Preceding work

Complete these dependencies, or supply their agreed outputs before taking this ticket.

Acceptance criteria

  • Compare the current plan with at least one partial index aligned with the actual open-state predicate and order.
  • Measure index size, inbox latency and update throughput for work moving into and out of the indexed state.
  • Keep the candidate only if its read benefit and write tradeoff satisfy explicitly stated exercise budgets.

Implementation constraints

  • Use three paired runs on the same synthetic data and settings; do not force index use or disable planner options to manufacture a result.

Verification to include

  • Run open, closed and mixed-state filters and verify both result equivalence and selected plans.
  • Close and reopen a fixed batch while reading the inbox; report lock waits, write duration and index size.

Deliverables

  • Index decision record, migration draft and comparative measurements

Rollout and recovery

Apply the index in the isolated database first; the rollback drops only the added index and preserves all work-order data.

Value of the work

For the engineer: Practice reading execution plans, balancing read and write cost, and validating performance without weakening tenant boundaries.

For the team: Create reproducible query diagnostics and reversible index or query proposals for an operational application.

Evidence boundaries

Outcome Evidence: Tests, patches, and runbooks are requested deliverables. They become Outcome Evidence only through a qualified Mission and immutable Evidence IDs.

Ownership Evidence: Independent adaptation must be observed under a declared verification policy and cite immutable Evidence IDs. Completing a planning ticket establishes no Ownership Evidence.