Time separation between each successive post in a Q&A chain

1

Please login or register to vote for this query.

(click on this box to dismiss)

Reference: https://meta.stackexchange.com/questions/331378/why-is-there-a-clustering-of-answers-at-full-half-hours-between-answers

Ask Ubuntu

Q&A for Ubuntu users and developers

WITH timeSeparation AS (
    SELECT
                q.Id                AS qstId
                , c.*
    FROM        Posts q
    CROSS APPLY (
        SELECT  a.Id                AS postId
                , a.CreationDate    AS postDate
                , minsAfter = DATEDIFF (mi, ISNULL (LAG (a.CreationDate) OVER (ORDER BY a.CreationDate), q.CreationDate), a.CreationDate)
        FROM    Posts a
        WHERE   a.PostTypeId    = 2
        AND     a.ParentId      = q.Id
    ) c
    WHERE       q.PostTypeId    = 1
    AND         q.AnswerCount   > 0
)
SELECT      ts.minsAfter
            , [Number of Answers with the given delay] = COUNT (ts.postId)
FROM        timeSeparation ts
WHERE       ts.minsAfter < 301  -- otherwise long tail swamps out plot
AND         ts.minsAfter >= 0   -- Answers can be older than questions if they were merged in. Discard those.
GROUP BY    ts.minsAfter
ORDER BY    ts.minsAfter

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results