SQL Fundamentals

ORDER BY & Sorting: Interview

Why should paginated queries include a deterministic tie-breaker? When several rows share the primary sort value, their relative order is undefined. Adding a un

Why should paginated queries include a deterministic tie-breaker?

When several rows share the primary sort value, their relative order is undefined. Adding a unique final key prevents rows from moving or repeating between requests.

Connect the ORDER BY columns to the supporting composite index.