2

There are some events that get logged in the PostHistory database that, as far as I can tell, always happen together:

  • a post gets merged: PostMergeSource, PostMergeDestination
  • a post is created: InitialBody, InitialTitle, InitialTags
  • similar for rollbacks: RollbackBody, RollbackTitle, RollbackTags

So why, when running a query over Worldbuilding's database, do I get these results?

Site            History Type Name       Instances
-------------------------------------------------
worldbuilding   Initial Body            25658
worldbuilding   Initial Title           4391
worldbuilding   Initial Tags            4391
worldbuilding   Rollback Body           49
worldbuilding   Rollback Title          23
worldbuilding   Rollback Tags           14
worldbuilding   Post Merge Destination  7
worldbuilding   Post Merge Source       1

It would seem to make sense for the numbers for each partner event to be the same, yet they're not. Why is this? Am I misinterpreting the events?


Data from the data dump imported into a MySQL database programmatically. Query:

SELECT
    `ph`.`Site` AS 'Site',
    `pht`.`Name` AS 'Type Name',
    COUNT(`ph`.`PostHistoryTypeId`) AS 'Instances'
FROM `PostHistory` AS `ph`
INNER JOIN `PostHistoryTypes` AS `pht` ON `ph`.`PostHistoryTypeId` = `pht`.`Id`
GROUP BY `ph`.`PostHistoryTypeId`, `ph`.`Site`
ORDER BY COUNT(`ph`.`PostHistoryTypeId`) DESC
LIMIT 1000;

1
  • Easy money that Initial Body contains not only answers but also tag wikis. And I'd also bet that Rollbacks are split by whether they affect various parts of the post. Feb 23, 2016 at 21:19

1 Answer 1

2

Answers do not have titles or tags, so InitialBody is expected to be larger, while InitialTitle and InitialTags are equal.

Rollback* revisions are dependent on what fields had modifications, so you can have 1 - 3 (body, title, and tags) corresponding events for the same rollback for questions, and body rollbacks for answers.

I'm not positive about the merge information though, I'm looking into that. Records corresponding to deleted content are typically removed from the data, so while you'll typically always have PostMergeDestination records, PostMergeSource records might be harder to come by.

In the case of Worldbuilding, the single PostMergeSource points to a non-deleted merge stub which might be behaving differently because it was migrated, closed, and then locked before being merged.

5
  • Huh, of course. Just me being slow and not realising answers are a thing around here.
    – ArtOfCode
    Feb 23, 2016 at 21:22
  • My guess for merge events would be that some of those source posts have been deleted and so they no longer appear in the data dump.
    – Adam Lear StaffMod
    Feb 23, 2016 at 21:26
  • @AdamLear Yeah, that seems reasonable. I wasn't sure why there was one record, but it seems that question had a bit of an involved history that might have prevented the stub from being killed, I guess?
    – Tim Stone
    Feb 23, 2016 at 21:28
  • @TimStone It could also just be something that hasn't yet been deleted at the time the data dump was produced. If memory serves, stubs are removed after 30 days, not immediately.
    – Adam Lear StaffMod
    Feb 23, 2016 at 21:40
  • 1
    Merge stubs (not migration stubs) are not automatically deleted unless they qualify for one of the normal rules (closed, abandoned). They're often removed by moderators however, particularly when merging exact duplicates from the same author.
    – Shog9
    Feb 23, 2016 at 21:44

You must log in to answer this question.

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