Opened 8 years ago

Closed 8 years ago

#25939 closed Cleanup/optimization (fixed)

Remove transaction from QuerySet.update_or_create's save()

Reported by: Tim Graham Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

According to Aymeric on the pull request:

It will have beneficial performance effects if:

  • ATOMIC_REQUESTS is not in use
  • update_or_create ends up creating an object
  • the save method of that objects does long things like sending email after the write (i.e. once it holds an exclusive lock on the database)

Change History (1)

comment:1 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In 423b3afc:

Fixed #25939 -- Removed redundant transaction in QuerySet.update_or_create().

There is no need to wrap the save() call in transaction.atomic() as
it's already done down the call stack in Model.save_base().

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