Does Firebird's ROWS clause return deterministic rows without an ORDER BY?
0 reputation · 29 Jul 2021, 21:42 UTC
When building a user‑facing list view that relies on Firebird's ROWS n TO m pagination, the application must present the same slice of data on each request to avoid confusing users.
Although the documentation warns that omitting an ORDER BY clause can lead to inconsistent page contents, it does not specify whether the presence of a clustered primary‑key index or the physical storage order influences the row sequence returned by a bare ROWS filter. This uncertainty makes it hard to decide whether relying on the implicit order is acceptable for a stable UI or whether an explicit sort is always required.
Does Firebird guarantee that repeated execution of a query such as SELECT * FROM MyTable ROWS 1 TO 10 returns identical rows when the table has a primary‑key index and no ORDER BY is supplied? If not, what factors (e.g., index layout, page allocation, concurrent DML) affect the order? Can adding an ORDER BY on the primary‑key column eliminate variability without causing a noticeable performance penalty?