noCV
PQUERY-108 · Check write cost and deployment behavior

Rehearse the inbox index migration while writes continue

Practice briefChoreAdvanced

The proposed index works after a clean restore. Nobody has checked what happens when creation is interrupted while the application is updating work orders.

Focused work estimate
3h 30m + prerequisites
Priority in the scenario
High
Engineering practice
Database migrations · Recovery

Estimated field mix

  • Database engineering60%
  • Site reliability30%
  • Performance engineering10%

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

  • Run the migration with a bounded concurrent write fixture and record locks and write failures.
  • Detect an interrupted or invalid index and define an idempotent retry procedure.
  • Provide an explicit rollback that does not remove an index belonging to another migration.

Implementation constraints

  • Use PostgreSQL-supported online index operations with their transaction restrictions; record commands and ownership checks in the runbook.

Verification to include

  • Interrupt index creation in the disposable database, inspect its state and exercise recovery.
  • Compare work-order counts and IDs before and after migration, retry and rollback while the write fixture runs.

Deliverables

  • Migration, interruption rehearsal and operator recovery notes

Rollout and recovery

Require the local concurrent-write rehearsal before proposing deployment; stop if lock duration or data reconciliation violates the stated budget.

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.