Skip to content
Code Recycle

Component · for humans & their agents

Postgres Planner Crossover

verified · first-partyactively maintained$0 during beta (was $59)

A query that was instant for a year is now a Seq Scan. Nothing changed — no deploy, no migration, no dropped index. The table simply grew past the crossover.

by datawright · Code Recycle maintainer

Get it free — beta

Every claim on this page is refundable if it is untrue — refund policy.

Verified: 96 tests

Find the ROW COUNT AT WHICH YOUR QUERY SILENTLY STOPS USING ITS INDEX.

Find the ROW COUNT AT WHICH YOUR QUERY SILENTLY STOPS USING ITS INDEX.

THE SYMPTOM. A query that was instant for a year is now slow. Nothing changed: no deploy, no code change, no schema migration, no index dropped. It got slower gradually, and then suddenly. EXPLAIN now shows a Seq Scan where it used to show an Index Scan or Bitmap Heap Scan. The query is still CORRECT -- it just reads the whole table now.

If an agent wrote the query there is often no human mental model of why this happened at all: the WHERE clause has not changed, so surely the plan should not either.

THE MECHANISM. PostgreSQL does not choose an index scan because an index exists. For every candidate plan it estimates a cost using a published formula, and picks the cheapest. As a table grows, the estimated cost of the index path and the sequential path both rise -- at different rates. There is a row count where the two lines CROSS, and past it the planner correctly prefers the scan. Nothing warns you when you pass it, because nothing went wrong.

THIS COMPUTES THE CROSSOVER from the same published cost parameters the planner uses, so you learn the row count BEFORE you reach it -- and can project it onto a calendar from your own growth rate. A number you can put in an alert is worth more than a plan you can read after the fact.

It also distinguishes a crossover you have genuinely passed from one caused by a bad row estimate, because the remedies are completely different and the EXPLAIN output looks similar.

VERIFIED: 96 tests, measured by running the suite.

DELIVERY: signed download of a hash-verified tarball, immediately on purchase. Permissive licence: unlimited products, unlimited clients, unlimited seats, no attribution, perpetual and irrevocable. One restriction, do not republish the source as source.

Interface

What you call, and what comes back. Types and signatures only — the implementation ships with the source.

  export function findCrossover(input: FindCrossoverInput): CrossoverResult | NotDeterminable;
  export function projectCrossoverToCalendar(crossoverRows: number, growthOverTime: GrowthOverTimePoint[]): CalendarProjection | NotDeterminable;
  export function findPlanNode(explainJson: unknown, nodeTypes: readonly string[]): ExtractedPlanNode | null;
  export function indexPagesFetched(tuplesFetched: number, tablePages: number, totalCompetingPages: number, effectiveCacheSizePages: number): number;
  export function indexScanCostAtRows(calibration: IndexScanCalibration, rows: number, matchedRows: number): number;
  export function seqScanCostAtRows(calibration: SeqScanCalibration, seqPageCost: number, rows: number): number;
  export function isNotDeterminable<T>(r: Checked<T>): r is NotDeterminable;
  export function mergeFailures(results: Checked<unknown>[]): NotDeterminable | null;
  export function validateCostConstants(input: Partial<CostConstants> | undefined | null):;
  export function validateCurrentTableStats( input: Partial<CurrentTableStats> | undefined | null, ):;
  export function validateObservedPlanCosts( input: Partial<ObservedPlanCosts> | undefined | null, ):;
  export function validateSelectivityModel(input: SelectivityGrowthModel | undefined | null):;
  export type Result<T> = (T & { determinable: true }) | NotDeterminable;
  export type Checked<T> = { ok: true;

01Capabilities

Does

  • + Data engineering
  • + Observability
  • + Query planning and index eligibility

Doesn’t

  • No exclusions declared

02Requirements & stack

Depends on

No declared dependencies

Credentials needed

None declared

Stack

typescript

03Community

No endorsements yet

No verified confirmations yet — be the first.

Confirmations come from verified purchasers, installers, vetted reviewers, or an installation outcome your org reported through the agent tools. They grade quality — security is verified separately, and community votes can never override the security gate.

Open an issue

Sign in to confirm — weight comes from verified usage, not vote count.

0 open · 0 answered · 0 fixed · 1 said it worked

04Trust Passport

Full passport →
–/100

0/0 automated components pass. An automated score is never a security guarantee.

✓ Verified · first-partyreviewed Sep 20, 2026 · re-verification due Dec 19, 2026
  • publisher identity Publisher status verified; 1 verification(s) on file
  • malicious pattern scan No known malicious-behavior patterns across 22 source file(s) plus listing text
  • capability contract All 0 observed capability reference(s) match the declared manifest
  • agent safety scan No injection patterns in agent-readable content
  • provenance No release signature or provenance attestation
  • behavioral sandbox Not performed in this environment — requires the production isolated runner (docs/sandbox-requirements.md). No untrusted code is ever executed on the application host.

Every listing must pass this review before it can be sold, and it is re-run on every release. Verification describes what we checked — it is not a guarantee that the software is safe.

VersionChannelReleasedNotes
1.0.0stableAug 6, 2026First public release.