netzkolchose / django-computedfields

Provides autogenerated autoupdated database fields for model methods.
MIT License
94 stars 14 forks source link

minor optimization possible with .only? #116

Open jerch opened 2 years ago

jerch commented 2 years ago

In theory we know all local fields, that are needed to update a cf, thus could lower the db/ORM/memory stress by only loading those fields with .only.

Needs some investigation, whether the savings are worth the trouble, because there is a nasty downside - if a local field was forgotten in the self-depends rule, the field value gets loaded lazy for every single object, thus runtime might explode again for bigger changesets.

jerch commented 1 year ago

This is also linked to the issue, that we currently dont have any measures in place to enforce dependency strictness between depends and the function. Also see https://github.com/netzkolchose/django-computedfields/issues/135#issuecomment-1787104107.