SET TIME ZONE called too often for postgresql_psycopg2 backend
|Reported by:||Jack Moffitt <metajack@…>||Owned by:||adrian|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Analyzing our database logs I found that 25% of all traffic were calls to SET TIME ZONE. This is currently called for every cursor when using the postgrsql_psycopg2 backend. This only needs to be called when the connection is established. All cursors will get the correct timezone if it is set in the connection.
I've attached a patch which calls SET TIME ZONE only on new connections. This eliminates a lot of wasted database traffic and can result in a large performance gain for loaded systems using this backend.
Change History (7)
comment:1 Changed 8 years ago by Jack Moffitt <metajack@…>
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 8 years ago by SmileyChris
- Triage Stage changed from Unreviewed to Ready for checkin