Why Does LIMIT + ORDER BY Yield Different Results in MySQL? Uncovering the Priority‑Queue Threshold
This article reproduces MySQL's official LIMIT‑optimization example, shows how adding rows changes the ORDER BY + LIMIT result, explains the hidden priority‑queue mechanism revealed by optimizer_trace, and derives the exact row‑count threshold where the behavior switches.
