Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#21109 closed Cleanup/optimization (fixed)

Performance regression due to wrap_database_errors

Reported by: Anssi Kääriäinen Owned by: nobody
Component: Database layer (models, ORM) Version: 1.6-beta-1
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Djangobench comparison between 1.5.x and 1.6.x revealed a problem with database error wrapping. Somewhat surprisingly the reason for the regression is functools.wraps. In addition it is possible to use @cached_property for connection.wrap_database_errors.

The regression was around 10% for query_iterator and around 50% for raw_sql djangobench benchmarks.

A patch is available from There is a minor comment fix to be done, otherwise ready for checkin.

Discussion about performance of 1.5.x vs 1.6.x:!topic/django-developers/ytr3j8suVxE

Change History (2)

comment:1 Changed 6 years ago by Anssi Kääriäinen <akaariai@…>

Resolution: fixed
Status: newclosed

In 94001421321bd8808c4027a72aa32a1eef005764:

Fixed #21109 -- made db cursor error wrapping faster

comment:2 Changed 6 years ago by Anssi Kääriäinen <akaariai@…>

In 5937f291c1dd74b40ab14be7b8a8112ff91ac08e:

[1.6.x] Fixed #21109 -- made db cursor error wrapping faster

Backpatch of 94001421321bd8808c4027a72aa32a1eef005764 from master.

Note: See TracTickets for help on using tickets.
Back to Top