Post Scores Histograms (Log Scale)

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- View the graph output
-- Graphs the number of posts at each score, where there are at least
-- a minimum number of posts for that score (reduce outlier scores).

-- note the use of a logarithmic scale on the Y axis (post count).

with PostScores as (
    select p.Score,
           p.PostTypeId,
           count(*) * 1.0 as PostCount
    from Posts p
    where p.PostTypeId in (1,2)
      and ClosedDate is null
    group by Score, p.PostTypeId
)
select Score,
       case when PostTypeId = '1'
            then 'Questions'
            else 'Answers'
       end as Series,
       LOG10(PostCount) as [CountLog10]
from PostScores
where PostCount >= ##MinPostCount:int?2##
  and Score >= ##MinScore:int?-10##
  and Score <= ##MaxScore:int?150##
order by Score, Series

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results