mvpdev/django-eav — pull request #17 by nicpottier (2013-02-19 15:11:45+00:00)
Title: DB Optimization for save and validate

We have one big install that uses XForms and it was starting to get pretty slow. Upon further investigation, the cause was the save() and validate_attributes() methods in EAV, which due to __getattr__ overloading were causing single DB queries for every attribute on an entity for each save. (actually * 2 because it was taking place both in save and validate)

For XForm installs with many forms and many fields this was turning into hundreds of single DB queries for every save.

This optimizes things by getting all the db values for an entity all at once when doing validation and saving.

Passes the django-eav tests as well as the very rigorous tests we have for that project, so I think it is an easy win for anybody.