Opened 3 years ago

Closed 2 years ago

#17823 closed New feature (needsinfo)

Add nolock support to queryset API

Reported by: mlissner 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 Changed 3 years ago by akaariai

  • Cc anssi.kaariainen@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 3 years ago by aaugustin

  • Triage Stage changed from Unreviewed to Design decision needed

comment:3 Changed 2 years ago by aaugustin

  • Resolution set to needsinfo
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.
Back to Top