| Summary: | Bug on using pagination in big resultlists in conjunction with ordering on a column with low variation (Oracle-DB)? | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Marcel Pokrandt <marcel.pokrandt> |
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> |
| Status: | ASSIGNED --- | QA Contact: | |
| Severity: | minor | ||
| Priority: | P2 | CC: | christopher.delahunt, cvgaviao, tom.ware |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Marcel Pokrandt
I just made up a small testcase to reproduce the problem - which does it on my Oracle-DB
----------------------------------
create table t
(id not null, col1, col2, data)
as
select rownum id, rownum col1, rownum col2, 'test' data
from dual
connect by level <= 30000;
create table t2
(id not null, ref_id)
as select rownum id, rownum ref_id
from dual
connect by level <= 30000;
update t set data = 'tes3' where id < 2000;
update t set data = 'tes2' where id < 1000;
SELECT * FROM
(SELECT a.*, ROWNUM rnum FROM (
select t.id, t.data from t, t2 where (t2.ref_id = t.id) order by data asc
) a
WHERE ROWNUM <= 10040
) WHERE rnum > 10010
;
SELECT * FROM
(SELECT a.*, ROWNUM rnum FROM (
select t.id, t.data from t, t2 where (t2.ref_id = t.id) order by data asc
) a
WHERE ROWNUM <= 10030
) WHERE rnum > 10000
;
--------------------------
I formulated the 2 select-statements as eclipselink does - compare the output of the two. And then compare to
SELECT * FROM
(SELECT a.*, ROWNUM rnum FROM (
select t.id, t.data from t, t2 where (t2.ref_id = t.id) order by data asc
) a
) WHERE rnum > 10010 and rnum <= 10040
;
SELECT * FROM
(SELECT a.*, ROWNUM rnum FROM (
select t.id, t.data from t, t2 where (t2.ref_id = t.id) order by data asc
) a
) WHERE rnum > 10000 and rnum <= 10030
;
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines I will try and look into the test case, but in the mean time maybe you can add why the new query will work on a non-deterministic order by field. The suggested query should have the same problem, assuming that Oracle can return different rnum values for the 10,000 rows matching that order value in two different queries. I believe the only solution is to use a more deterministic order by field, such as the ID as you have mentioned. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |