Browse files

DISTINCT on trending query to prevent duplicate rows returned

  • Loading branch information...
1 parent 9295016 commit 1a3977919cd67003bc56faf3aa8c3a632028eff9 @dcramer dcramer committed Oct 8, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/sentry/manager.py
View
2 src/sentry/manager.py
@@ -741,7 +741,7 @@ def get_accelerated(self, queryset=None, minutes=15):
after_group = after_group.split(' ORDER BY ')[0]
query = """
- SELECT (SUM(%(mcbm_tbl)s.times_seen) * (%(norm)f / (%(epoch_clause)s / 60)) + 1.0) / (COALESCE(z.rate, 0) + 1.0) as accel,
+ SELECT DISTINCT (SUM(%(mcbm_tbl)s.times_seen) * (%(norm)f / (%(epoch_clause)s / 60)) + 1.0) / (COALESCE(z.rate, 0) + 1.0) as accel,
(COALESCE(z.rate, 0) + 1.0) as prev_rate,
%(before_where)s
LEFT JOIN (SELECT a.group_id, SUM(a.times_seen) / COUNT(a.times_seen) / %(norm)f as rate

0 comments on commit 1a39779

Please sign in to comment.