Opened 4 years ago

Closed 4 years ago

#32082 closed New feature (needsinfo)

Support "Row Values" in where clause / filter

Reported by: Esteban C Borsani Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Esteban C Borsani)

Using "row values" in the where clause is the only way to make pagination efficient. There is a variation that does not require row values, but it cannot make proper use of composite indices, which usually makes it slower than the more known offset/limit approach (which is already quite slow).

Unless I'm missing something, it seems the only way to implement this is using the QuerySet extra method, and I'd like to avoid that.

Here is a sqlite example of row values, btw:

SELECT * FROM contacts
 WHERE (lastname,firstname) > (?1,?2)
 ORDER BY lastname, firstname
 LIMIT 7;

Change History (2)

comment:1 by Esteban C Borsani, 4 years ago

Description: modified (diff)

comment:2 by Carlton Gibson, 4 years ago

Resolution: needsinfo
Status: newclosed

Hi. Thanks for the suggestion here.

I'm going to ask that you open a discussion the DevelopersMailingList about this topic to draw in more comments.

It may indeed be better than using OFFSET, but is it supported by all supported DBs, and what might implementation look-like?
(On this last, is an implementation going to be sufficiently simple for complex cases?)

Assuming folks are keen (why not?) I think we need at least a proof-of-concept as to what the addition might look like to move forward.

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