Conceptual
Login

LIMIT Without ORDER BY Gives You Arbitrary Rows, Not the First Ones

SQL guarantees no row order unless you ask for one, so LIMIT 10 without ORDER BY means any ten rows the engine happened to produce first. The same query can return different rows tomorrow simply because the plan changed or rows moved on disk. This matters most for paging: two pages fetched with LIMIT and OFFSET but no total order can show you the same row twice and skip another entirely.

Questions this Concept answers

  • Why can paging with `LIMIT` and `OFFSET` show a user the same row twice when no total order is specified?