Search code examples
stackexchangedataexplorer

Can I get deleted posts from the PostHistory table using the Stack Exchange Data Explorer?


I am trying to get the deleted posts by users. According to the Database schema documentation, in the PostHistory table, the PostHistoryTypeId = 12 means "Post Deleted".

So, can I get the deleted post for a user by the following query?

Select * from PostHistory where PostHistoryTypeId = 12

If not, then how can I get deleted posts either by user or by moderator?


Solution

  • That query on PostHistory only shows posts that where deleted and then later undeleted.

    You can't search SEDE for currently deleted posts by user because as this Stack Exchange developer said:

    ... UserIds are also null for deleted posts (in the Data Explorer), for obvious reasons.

    Deleted posts, like vote records, are considered sensitive information.

    If you have 10K privileges, you can see deleted posts as you stumble across them, but cannot search for them unless they're your own posts.
    Moderators and Stack Exchange developers have more tools available in this regard.

    See also: