Opened 12 years ago

Closed 11 years ago

#17823 closed New feature (needsinfo)

Add nolock support to queryset API

Reported by: Mike Lissner Owned by: nobody
Component: Database layer (models, ORM) Version: 1.3
Severity: Normal Keywords:
Cc: anssi.kaariainen@… Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In a number of circumstances, it would be great if there was a way of designating a query as non-locking:

  • the sitemaps API creates locking queries on MySQL. On a large site with thousands of pages, this query thus stops the database until the search crawler has gotten its fill of sitemaps.
  • API queries - My project has an API that generates dump files for users so that they can export the data from the site. These queries are pretty slow, and unfortunately they too are locking, even though they don't need to be.
  • deep pagination - on a site with very deep pagination, the offset queries can be quite slow. I believe these are locking queries too, creating problems.

I took a look at implementing this myself, but got rather lost in the query code very quickly. I know we can do this via raw queries, but that comes with a good deal of complication (e.g., things like the sitemaps and pagination are hard to re-implement using raw queries).

Not sure how this would fit into the current API, but I'd love to have it available down the road. Happy to help implement if possible, but I'll need guidance.

Change History (3)

comment:1 by Anssi Kääriäinen, 12 years ago

Cc: anssi.kaariainen@… added

A quick question: what does a non-locking query exactly mean? I know data modification does lock the object for other modifications, but why would read operations do that? So, how would this be done in raw SQL? Pointers to documentation of different database vendors welcome.

comment:2 by Aymeric Augustin, 12 years ago

Triage Stage: UnreviewedDesign decision needed

comment:3 by Aymeric Augustin, 11 years ago

Resolution: needsinfo
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top