Skip to content

Commit

Permalink
Remove max date query as its unbelievably slow (the counter is not)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Mar 1, 2012
1 parent a5fc0d3 commit 2dbbff0
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 14 deletions.
5 changes: 0 additions & 5 deletions sentry/templates/sentry/admin/projects/list.html
Expand Up @@ -25,13 +25,11 @@
<col>
<col style="width:150px;">
<col style="width:150px;">
<col style="width:50px;">
</colgroup>
<thead>
<tr>
<th>{% trans "Project" %}</th>
<th style="text-align:center;">{% trans "Daily Events" %}</th>
<th style="text-align:center;">{% trans "Last Event" %}</th>
</tr>
</thead>
<tbody>
Expand All @@ -52,9 +50,6 @@
<td style="text-align:center; vertical-align:middle;">
<em>~{{ project|avg_events_per_day }}</em>
</td>
<td style="text-align:center; vertical-align:middle;">
{{ project.last_event|timesince }}
</td>
</tr>
{% endfor %}
</tbody>
Expand Down
5 changes: 0 additions & 5 deletions sentry/templates/sentry/admin/users/list_projects.html
Expand Up @@ -24,13 +24,11 @@
<col>
<col style="width:150px;">
<col style="width:150px;">
<col style="width:50px;">
</colgroup>
<thead>
<tr>
<th>{% trans "Project" %}</th>
<th style="text-align:center;">{% trans "Daily Events" %}</th>
<th style="text-align:center;">{% trans "Last Event" %}</th>
</tr>
</thead>
<tbody>
Expand All @@ -43,9 +41,6 @@
<td style="text-align:center; vertical-align:middle;">
<em>~{{ project|avg_events_per_day }}</em>
</td>
<td style="text-align:center; vertical-align:middle;">
{{ project.last_event|timesince }}
</td>
</tr>
{% endfor %}
</tbody>
Expand Down
4 changes: 1 addition & 3 deletions sentry/web/frontend/admin.py
Expand Up @@ -15,7 +15,7 @@
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.db import transaction
from django.db.models import Sum, Count, Max
from django.db.models import Sum, Count
from django.http import HttpResponseRedirect
from django.views.decorators.csrf import csrf_protect
from kombu.transport.django.models import Queue
Expand Down Expand Up @@ -54,7 +54,6 @@ def manage_projects(request):
).exclude(
projectcountbyminute__date__lte=datetime.datetime.now() - datetime.timedelta(days=30),
).annotate(
last_event=Max('messagecountbyminute__date'),
avg_events_per_n=Sum('projectcountbyminute__times_seen'),
n_value=Count('projectcountbyminute__times_seen')
).select_related('owner').order_by('-date_added')
Expand Down Expand Up @@ -198,7 +197,6 @@ def list_user_projects(request, user_id):
).exclude(
projectcountbyminute__date__lte=datetime.datetime.now() - datetime.timedelta(days=30),
).annotate(
last_event=Max('messagecountbyminute__date'),
avg_events_per_n=Sum('projectcountbyminute__times_seen'),
n_value=Count('projectcountbyminute__times_seen')
).order_by('-date_added')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -49,7 +49,7 @@

setup(
name='sentry',
version='3.4.0',
version='3.4.1',
author='David Cramer',
author_email='dcramer@gmail.com',
url='http://github.com/dcramer/sentry',
Expand Down

0 comments on commit 2dbbff0

Please sign in to comment.