Known information:

  1. As per this answer comments can't be downvoted.

  2. VoteTypeId 3 means downvote on a given post. referred answer

My Assumption: Comments should not be downvoted and therefore Votes table on SEDE StackoverFlow (StackExchange Data Explorer) should not have entries with VoteTypeId = 3 for any comment as a PostId.


I ran the following query on SEDE StackOverflow to test my assumption. Following query extracts all the comments of answers of a given QuestionId and finds their entries in Votes table.

select * from votes where postid in
(select id from comments where postid in 
(select id from posts where parentid = 7172459))

I found that there are several entries for some comments with VoteTypeId = 3.

Can anyone please explain if the VoteTypeIds have different notion when considered them in the context of a Comment?


The PostId in the votes table is a foreignkey to the Post table and the Posts table only. The id's found there don't relate in anyway to the comments table. Joining them makes no sense from an information point of view.

    |      |1
    |   +----------------+              +------------------+
    |   |                |              |                  |
    |   |                |              |    Votes         |
    |   |   Posts        |1            *|    -VoteTypeId   |
    |   |    -Id         +--------------+    -PostId       |
    +---|    -ParentId   |              |                  |
       *|                |              |                  |
        +----------------+              +------------------+
                | 1
                |                       +----------------+
                |                       |                |
                |                       |   Comments     |
                |                      *|   -Id          |
                +-----------------------|   -PostId      |
                                        |   -Score       |
                                        |                |

Use the score attribute in the comments table to find how many times the comment was upvoted. You can't get any extra meta-data about that score, like creationdate of the vote.

See Database schema documentation for the public data dump and SEDE for the full schema and also scroll down to the ERD in the second answer.

  • Is there a way to get last upvote date for a comment? – Aditya Narkar Apr 13 '19 at 9:10
  • 2
    @AdityaNarkar no, you can't get that info. It is not in the public SEDE and I'm not even sure if it is internally tracked. – rene Apr 13 '19 at 9:37
  • Definitely agree of it not being in public SEDE, however I think it's definitely being tracked internally. For example, one of the features in SO is not being able to upvote a comment again after you upvoted and undo. You can try this by upvoting a comment, then cancel the upvote and tried upvoting again. You will get a prompt saying that you cannot do this. This means that they must be tracking userId which has previously upvoted a comment. – velociraptor11 Mar 15 '20 at 18:51
  • @velociraptor11 That is true, I was making an educated guess about the upvote date. – rene Mar 15 '20 at 19:43

You must log in to answer this question.

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