Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize query count in notification.views.notices #33

Open
zsiciarz opened this issue Jun 8, 2010 · 0 comments
Open

Optimize query count in notification.views.notices #33

zsiciarz opened this issue Jun 8, 2010 · 0 comments

Comments

@zsiciarz
Copy link

zsiciarz commented Jun 8, 2010

Currently the notices() view does not retrieve notice types together with notices for current user. If the template processes each notice like below:

{% for notice in notices %}
  {{ notice.notice_type.display }}
{% endfor %}

each notice_type is fetched separately from the database. When the user is displayed a lot of notifications, query count will quickly increase. I propose a patch to optimize away most of these queries by using select_related() in the view function.

Patch: http://gist.github.com/429952

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant