mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 02:22:44 +01:00
Migration 0126 samples `rom_identity_keys` right after its backfill, which on a fresh install runs while the table is still empty. The first scan then fills it through the triggers, and MariaDB keeps planning `sibling_roms` against the empty sample: measured on 37k key rows, one gallery page's sibling statement takes 891.7 ms in that state against 2.1 ms once resampled, which is worse than the 550.7 ms the view it replaces cost. InnoDB's auto-recalc does not cover it. It fires and updates the stored row count, but the plan does not change until the table is reopened or analyzed: 90 s after a trigger-paced fill, `mysql.innodb_table_stats` was correct and the plan was still the block-nested-loop one. Addresses the "Fresh Installs Keep Stale Statistics" review comment on #4394. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>