Add nolock support to queryset API
|Reported by:||mlissner||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.3|
|Cc:||anssi.kaariainen@…||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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 4 years ago by akaariai
- Cc anssi.kaariainen@… added
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 4 years ago by aaugustin
- Triage Stage changed from Unreviewed to Design decision needed