6

I know that comments do not give reputation and understand the reasoning behind it. However, I would still be interested in comment statistics for a user (at least myself), showing things like:

  • Number of comments posted in total
  • Number of comments posted per day/week/month/...
  • Number of comment upvotes total
  • Number of average upvotes per comment

While user profiles show a lot of information on a user's questions and answers, I could not find anything like it for comments. The only thing in that general sense is probably the Pundit Badge.

Is there a possibility to fetch any such information?
Are there any plans of adding such information to user's profiles?

3

You can see these stats with a SEDE Query

Here it is, just a bunch of CTE's to get the stats and rank for all users. In the final result the stats for the selected user will be shown at the top, followed by the top 100 commenters, based on count.

;with daystat as
(
select userid
     , avg(cnt) [value]
from (
select userid
     , cast(creationDate as date) as grp
     , count(*) as cnt
from comments
where userid is not null
group by userid, cast(creationDate as date)
)as d
group by userid
)
, monthstat as
(
select userid
     , avg(cnt) value
from (
select userid
     , eomonth(creationDate) as grp
     , count(*) as cnt
from comments
where userid is not null
group by userid, eomonth(creationDate)
)as d
group by userid
)
, yearstat as
(
select userid
     , avg(cnt) value
from (
select userid
     , year(creationDate) as grp
     , count(*) as cnt
from comments
where userid is not null
group by userid, year(creationDate)
)as d
group by userid
)
, allusers as
(
select rank() over (order by count(*) desc) [rank]
     , c.userid
     , u.displayname
     , count(*) as [Number of comments]
     , min(ds.value) as [Comments per day]
     , min(ms.value) as [Comments per month]
     , min(ys.value) as [Comments per year]
     , sum(c.score) as [Total score]
     , avg(cast(c.score as decimal)) as [Avg score]
from comments c
inner join daystat ds on ds.userid = c.userid
inner join monthstat ms on ms.userid = c.userid
inner join yearstat ys on ys.userid = c.userid
inner join users u on u.id = c.userid
where c.userid is not null
group by c.userid,   u.displayname
)

select rank
     , 'site://users/'+ cast(userid as nvarchar) + '|' +  displayname [User]
     , [Number of comments]
     , [Comments per day]
     , [Comments per month]
     , [Comments per year]
     , [Total score]
     , [Avg score]
from allusers 
where userid = ##userid##
union all
select top 100 
       rank
     , 'site://users/'+ cast(userid as nvarchar) + '|' +  displayname [User]
     , [Number of comments]
     , [Comments per day]
     , [Comments per month]
     , [Comments per year]
     , [Total score]
     , [Avg score]
from allusers

When run today the result looks like this:

comment stats

Keep in mind SEDE is only refreshed once a week, on Sunday. If you're new to SEDE, don't forget to visit the awesome tutorial.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .