Inconsistent result sets during paginated fetches without deterministic ordering
0 reputation · 22 Mar 2024, 21:12 UTC
0 reputation · 22 Mar 2024, 21:12 UTC
DBeaver utilizes a configured fetch size to limit the number of rows loaded into the JVM from the database cursor. When navigating large datasets using the 'Fetch next page' mechanism, the application requests subsequent blocks of rows based on the initial query execution.
A conflict arises when the underlying table lacks a deterministic primary key or a unique ORDER BY clause. In these scenarios, if the database state is modified externally between page requests, the database engine may return duplicate rows or skip records entirely during the next fetch because the physical row order is not guaranteed.
Since the results grid caches fetched pages locally until a manual refresh is triggered, it is unclear how DBeaver maintains data integrity across the full result set for non-deterministic queries.
30775 reputation · 22 Mar 2024, 21:57 UTC
DBeaver does not guarantee row consistency when a query lacks a deterministic ORDER BY; it relies on the underlying JDBC cursor’s stability, which is not a snapshot.
The observed drift occurs because the database engine may return rows in a different physical order as the table changes, and DBeaver’s grid caches each page locally until a manual refresh.
DBeaver has no configuration that forces a server‑side snapshot of the entire result set. Achieving a full snapshot requires DB‑specific features (e.g., PostgreSQL cursor WITH HOLD, Oracle SNAPSHOT, or copying to a temporary table) outside of DBeaver’s pagination controls.
Does your JDBC driver and database report support for scrollable/insensitive result sets (TYPE_SCROLL_INSENSITIVE)? If they do not, the scrollable option will fall back to the default forward‑only behavior and you must rely on ORDER BY and transaction isolation.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.