Настоящий PostgreSQL работает локально в Web Worker. Запросы дают реальный planner evidence, DDL откатывается после behavioral probes, а maintenance fixture удаляется после каждого запуска.
LOCAL DATABASEPostgreSQL в этой вкладке
CASE / B-TREE / RANGE / COVERING READ
Newest pending orders
Support asks for the five newest pending orders of tenant 42 created since 2026-05-01. Return exactly id, UTC minute as created_utc, and total_cents.
DATASET
60 000 rows
TIMEBOX
20 min
STATE
ephemeral
01 / CONTRACT
Что нужно доказать
Use equality keys before the range, preserve deterministic ordering and prove that the covering index serves the read.
Equality, then range, then order
The index begins with tenant_id and status equalities. created_at is then both a range boundary and the leading order key; id breaks timestamp ties. LIMIT is meaningful only after that deterministic order is established.
Covering is a write trade-off
INCLUDE makes total_cents available to an index-only plan without changing search order. It can remove heap reads when visibility permits, but every included byte still increases index storage and write amplification.
SCHEMA / READ ONLY60K FIXTURE
orders
id bigint primary key
tenant_id integer not null
status text not null
created_at timestamptz not null
total_cents integer not null
payload text not null
orders_tenant_status_created_idx
btree (tenant_id, status, created_at desc, id desc)
include (total_cents)
02 / QUERY
SQL console
Инициализация SQL-редактора…
LOCAL WASMread only · 1 statement · 1.5 s
RESULT / EXPLAIN
Запустите локальную PostgreSQL — dataset останется только в этой вкладке.