#27335: Avoid object save during QuerySet.update_or_create() when there were no changes -------------------------------------+------------------------------------- Reporter: tonnzor | Owner: Andrew Type: | Nester Cleanup/optimization | Status: assigned Component: Database layer | Version: master (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Andrew Nester): Hi @tonnzorr As discussed in pull request linked to this ticket implementing this optimization might cause some issues not covered here previously. Some of them: 1. Handling foreign key changes 2. Regression of auto_now feature 3. Updating models backed by tables with triggers and so on. My point here is that implementing this feature requires a lot of time comparing with profit we can gain from it, so it looks like we are trying to be too smart here and it's a little bit dangerous because this optimization looks like source of potential regression. I am just curious to know your opinion about it because my point here is that it's better to leave behavior of update_or_create as it is now. -- Ticket URL: <https://code.djangoproject.com/ticket/27335#comment:3> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.4caaae3dd61d6baa2a0964a89ec03e27%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.