Django development: possible change of the .save() implementation

An interesting topic by Anssi Kääriäinen flew by django-developers mailing list about ticket #16649: “ refactoring: check updated rows to determine action”. The ticket mentions a 50% performance optimization. Here’s an explanation by akaariai (core developer): A bit more information about what the approach suggested is about. Assume you load a model from DB, change some fields and save it. We currently do: SELECT - load from DB [change fields]; save() In save: SELECT - assert that the PK exists in the DB if yes: UPDATE else: INSERT The second select above is usually redundant. [Read More]

Django & DBAs: "Performance problems due to incorrect many-many primary key on many tables"

Extract from a great thread on the django-developper mailing list started by Trey Raymond: I’m a DB engineer working for Yahoo, and we have a new product using django that I’m onboarding. We see a variety of easily fixed issues, but one major one - there are 21 many-many tables here, yet they have auto increment primary keys Looking forward to see how it goes ! Star the thread. [Read More]