Efficient update query on model.save()
|Reported by:||Andrei Antoukh||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.4|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Django, by default saves all fields of the object on call save() method. I've seen that with slightly larger models, is quite inefficient.
I implemented this patch, in my case solves this problem. Would be nice, that django has this functionality by default.I have seen this issue, which appears to be related. I have seen the implementation and seen that they might be trying to solve 2 things at once.
In my case, just keep the status attribute, and only keep those that have changed. Works with inheritance 2 tables.This is a proposal. With pleasure I will write testcases for this, if is necessary.