Opened 7 weeks ago

Closed 6 weeks ago

#28670 closed Cleanup/optimization (fixed)

Add native LIMIT/OFFSET support on Oracle.

Reported by: Markus Stenberg Owned by: felixxm
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently the code which does the LIMIT+OFFSET clause emulation there with ROWNUM (which assorted sources on the internet recommend not to do) is no longer needed. Oracle 12 supports SQL syntax for this:

https://oracle-base.com/articles/12c/row-limiting-clause-for-top-n-queries-12cr1

[ OFFSET offset { ROW | ROWS } ]
[ FETCH { FIRST | NEXT } [ { rowcount | percent PERCENT } ]
    { ROW | ROWS } { ONLY | WITH TIES } ]

This applies to all versions, but is probably reasonable to implement in 2.0+ onlyas then there is no need to worry about Oracle 11 which does not support the syntax.

Change History (6)

comment:1 Changed 7 weeks ago by felixxm

Triage Stage: UnreviewedAccepted
Version: 2.0master

comment:2 Changed 7 weeks ago by felixxm

Owner: changed from nobody to felixxm
Status: newassigned
Summary: django/db/backends/oracle/compiler.py handling of LIMIT+OFFSET could be better in Oracle 12+.Add native LIMIT/OFFSET support on Oracle.

comment:3 Changed 7 weeks ago by GitHub <noreply@…>

In 03da070:

Refs #28670 -- Moved LIMIT/OFFSET SQL to DatabaseOperations.limit_offset_sql().

Thanks Tim Graham for the review.

comment:4 Changed 6 weeks ago by felixxm

Has patch: set

comment:5 Changed 6 weeks ago by Tim Graham

Triage Stage: AcceptedReady for checkin

comment:6 Changed 6 weeks ago by GitHub <noreply@…>

Resolution: fixed
Status: assignedclosed

In 0899d583:

Fixed #28670 -- Added FETCH/OFFSET support on Oracle.

Thanks Tim Graham for the review.

Note: See TracTickets for help on using tickets.
Back to Top