[Django] #26712: Avoid unnecessary SET TIMEZONE queries on PostgreSQL when no changes are required

17 views
Skip to first unread message

Django

unread,
Jun 5, 2016, 11:45:47 PM6/5/16
to django-...@googlegroups.com
#26712: Avoid unnecessary SET TIMEZONE queries on PostgreSQL when no changes are
required
-------------------------------------+-------------------------------------
Reporter: charettes | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The `setting_changed` receiver for the `TIME_ZONE` and `USE_TZ` settings
inconditionally resets each connections timezones on every change even if
not required. This is not an issue for all backends except PostgreSQL
where a query needs to be performed.

Whether or not actions must me performed on `TIME_ZONE` and `USE_TZ`
change should be delegated to the backend specific connection and signal
receivers should only have to clear possibly stale cached values.

--
Ticket URL: <https://code.djangoproject.com/ticket/26712>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 5, 2016, 11:50:02 PM6/5/16
to django-...@googlegroups.com
#26712: Avoid unnecessary SET TIMEZONE queries on PostgreSQL when no changes are
required
-------------------------------------+-------------------------------------
Reporter: charettes | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by charettes):

* needs_tests: 0 => 1


Comment:

[https://github.com/django/django/pull/6731 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/26712#comment:1>

Django

unread,
Jun 6, 2016, 8:21:25 AM6/6/16
to django-...@googlegroups.com
#26712: Avoid unnecessary SET TIMEZONE queries on PostgreSQL when no changes are
required
-------------------------------------+-------------------------------------
Reporter: charettes | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_docs: 0 => 1
* has_patch: 0 => 1
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/26712#comment:2>

Django

unread,
Jun 6, 2016, 10:37:14 AM6/6/16
to django-...@googlegroups.com
#26712: Avoid unnecessary SET TIMEZONE queries on PostgreSQL when no changes are
required
-------------------------------------+-------------------------------------
Reporter: charettes | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by charettes):

* needs_docs: 1 => 0
* needs_tests: 1 => 0


Comment:

(I had accidently checked ''needs tests'' instead of ''has patch'' when I
linked to the PR)

--
Ticket URL: <https://code.djangoproject.com/ticket/26712#comment:3>

Django

unread,
Jun 6, 2016, 10:48:24 AM6/6/16
to django-...@googlegroups.com
#26712: Avoid unnecessary SET TIMEZONE queries on PostgreSQL when no changes are
required
-------------------------------------+-------------------------------------
Reporter: charettes | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/26712#comment:4>

Django

unread,
Jun 6, 2016, 11:27:58 AM6/6/16
to django-...@googlegroups.com
#26712: Avoid unnecessary SET TIMEZONE queries on PostgreSQL when no changes are
required
-------------------------------------+-------------------------------------
Reporter: charettes | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette <charette.s@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"b484f167bed61f4cff215208eddf98a0655239d4" b484f167]:
{{{
#!CommitTicketReference repository=""
revision="b484f167bed61f4cff215208eddf98a0655239d4"
Fixed #26712 -- Avoided unnecessary SET TIMEZONE queries on PostgreSQL.

A change of the USE_TZ or TIME_ZONE settings doesn't necessarily require a
change to the active connections' timezones.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26712#comment:5>

Django

unread,
Jun 6, 2016, 11:27:58 AM6/6/16
to django-...@googlegroups.com
#26712: Avoid unnecessary SET TIMEZONE queries on PostgreSQL when no changes are
required
-------------------------------------+-------------------------------------
Reporter: charettes | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Simon Charette <charette.s@…>):

In [changeset:"271581df606b307d89c141e8b1a50ace763bea81" 271581df]:
{{{
#!CommitTicketReference repository=""
revision="271581df606b307d89c141e8b1a50ace763bea81"
Refs #26712 -- Removed workarounds for PostgreSQL queries on TIME_ZONE
changes.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26712#comment:6>

Reply all
Reply to author
Forward
0 new messages