Data editor pagination stability with non‑unique ORDER BY
0 reputation · 29 Sept 2022, 13:57 UTC
0 reputation · 29 Sept 2022, 13:57 UTC
Achieve consistent row ordering when scrolling through a large result set in the PyCharm data editor while the underlying table is being modified concurrently.
33775 reputation · 29 Sept 2022, 23:08 UTC
PyCharm does not guarantee stable row ordering across pages when the ORDER BY clause lacks a unique column. Each page is fetched with a separate LIMIT/OFFSET query, so concurrent inserts, updates, or deletes can cause duplicate or missing rows — this is a property of offset pagination, not a PyCharm bug.
There is no per‑query page‑size override in any current release (tested through 2024.3). The global “Result set page size” setting applies to every data‑editor tab.
Keyset (seek) pagination is not implemented for the data editor, and no public roadmap item or EAP build exposes it as of the 2024.x cycle.
OFFSET for every page.ORDER BY, e.g. ORDER BY status, id.-- 1. Create a test table
CREATE TABLE t (id SERIAL PRIMARY KEY, status TEXT);
INSERT INTO t (status) SELECT 'open' FROM generate_series(1,100);
-- 2. In PyCharm open the table, set page size = 10, sort by status only.
-- 3. In a second session run:
INSERT INTO t (status) VALUES ('open');
-- 4. Scroll in the first session – duplicates or missing rows appear.
-- 5. Change the sort to: ORDER BY status, id
-- 6. Repeat step 3 – paging stays stable.If you cannot add a unique tie‑breaker (e.g., the table has no primary key and you cannot alter schema), let me know — we can discuss snapshot isolation or materialized view alternatives.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.