Concept and mechanism
A query can execute without errors while retaining ambiguous meaning. When grouping by fund and selecting a trader, ask whether that trader is determined by the group. ONLY_FULL_GROUP_BY detects many cases lacking functional dependency; disabling it can let the engine choose an arbitrary value. ORDER BY on results does not select the row representing each group. ANY_VALUE does not mean latest either. For pagination, add a unique key to break equal ordering values. That stabilizes order for the same dataset but does not freeze concurrent changes between requests.
Guided application
In a fictional report, compare estimates with actual rows before proposing an index. EXPLAIN ANALYZE executes the supported statement to collect metrics, so environment and load need control. A composite index has order: filters aligned with its leftmost prefix are useful candidates, but the final plan depends on data and cost. Using filesort indicates a sorting phase rather than proof of disk writes. Measure frequency, latency, volume, and write impact. Acceptance tests should include groups containing multiple members and ties, alongside sufficiently representative data to evaluate the improvement.
ORDER BY created_at, id resolves timestamp ties when id is unique; it does not create a snapshot across pages.
Common pitfalls
No error as correct; ANY_VALUE as latest; filesort as disk; composite index as independent indexes.
Related topics: Types and data contracts · InnoDB transactions and error paths · Safe integration and effective identity
Validate meaning and performance with examples that distinguish alternatives.
Reference: Deterministic grouping and functional dependence · MySQL 9.7 LTS with InnoDB reference semantics