Fixed
- Stats detail panels open in a blink instead of taking up to a minute. Opening Fastest, Slowest, Highest or Lowest altitude or Unique aircraft today, a Top types or Top operators row, or the full category or country breakdown could take 10–60 seconds on an install with a few weeks of history, because the database read every sighting it had kept to answer a question about today. These panels now read only today's sightings and typically open in well under a tenth of a second. They show the same results as before.
- The "All categories" breakdown matches the Category mix card. The full breakdown still sorted aircraft with an old copy of the category rules, so its numbers could disagree with the card it opens from, particularly for helicopters and regional airliners. It now uses the card's own categories, so the counts agree. Clicking its General Aviation row also opens the right Search now.
Behind the scenes
- Every drill query that reads today's slice of
all_sightingspinsINDEXED BY idx_all_seen_icao, and so does the per-row lookup of each record-setting sighting. With nosqlite_stat4, SQLite guesses thatseen_at >= midnightkeeps about a quarter of the table and walks all ofidx_all_icaoto avoid a GROUP BY sort. A fresh ANALYZE doesn't change that guess. - The four extremes drills find each aircraft's peak with a window
MAX/MIN … OVER (PARTITION BY icao)in one pass, instead of a CTE joined back to the table. A join let other planner statistics choose other slow plans: a skip-scan on busy installs, and a nested scan after a fresh install's one-aircraft first poll. all_category_mixtakes its counts from the card face's own query and today's totals from a pinned slice that probesseen_aircraftby primary key. The category labels live in one shared map.- New
test_stats_drills.pyEXPLAINs every statement the drills run under five planner-statistics profiles and allows only index seeks. It also covers the record-setting sightings and card/drill agreement. Checked against SQLite 3.34 through 3.50.