Add (user_id,date) + aircraft_type.iata indexes (audit M3) #7
Loading…
Reference in a new issue
No description provided.
Delete branch "perf/db-indexes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stacks on #6. Continues
docs/audit-2026-06.mdat M3.Migration
0005_naive_sentry.sql:flight_user_id_date_idxon(user_id, date)— serves the hot filter-by-user / order-by-date query; replaces the now-redundant standaloneuser_idindex (leftmost prefix covers user_id-only lookups).EXPLAIN QUERY PLANconfirms an index SEARCH with no separate sort step.aircraft_type_iata_idxoniata— covering index for theeq(iata, …)lookups in reference search and ICAO-over-IATA aircraft enrichment.Deliberately skipped:
countrycolumns (only leading-wildcardLIKE, un-indexable) and atail_numberindex (the aircraft-detail query is alwaysuser_id-scoped, so the composite already narrows it to a small per-user set; anUPPER(TRIM(...))expression index is overkill at personal scale).Verified: migration applies cleanly,
EXPLAIN QUERY PLANshows both indexes used,pnpm typecheck/lint/test(40/40) pass.aabc2ffa95to7265227404