Skip to content

Commit

Permalink
DISTINCT on trending query to prevent duplicate rows returned
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Oct 8, 2012
1 parent 9295016 commit 1a39779
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sentry/manager.py
Expand Up @@ -741,7 +741,7 @@ def get_accelerated(self, queryset=None, minutes=15):
after_group = after_group.split(' ORDER BY ')[0] after_group = after_group.split(' ORDER BY ')[0]


query = """ 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, (COALESCE(z.rate, 0) + 1.0) as prev_rate,
%(before_where)s %(before_where)s
LEFT JOIN (SELECT a.group_id, SUM(a.times_seen) / COUNT(a.times_seen) / %(norm)f as rate LEFT JOIN (SELECT a.group_id, SUM(a.times_seen) / COUNT(a.times_seen) / %(norm)f as rate
Expand Down

0 comments on commit 1a39779

Please sign in to comment.