Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ordering #76

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Ordering #76

wants to merge 3 commits into from

Conversation

itimky
Copy link

@itimky itimky commented Oct 20, 2018

There are cases when row-level deadlocks occur on simultaneous update, celery task & Django view for instance.
If update order is preserved (order by pk) there are no more deadlocks.
Implemented via CTE.
Added "ordered=False" for backward compatibility & keep overhead away if ordering not needed.

@mkomitee
Copy link

mkomitee commented Sep 5, 2019

I'm not sure that it matters much at this point, but this only ensures sorting within batches, so if you use the batch feature you're still exposed to the potential for deadlocks.

@itimky
Copy link
Author

itimky commented Sep 10, 2019

Correct, but it's possible to sort your data before passing it to bulk_update, so the sorting order will be preserved across all batches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants