Answer Delay

4

Please login or register to vote for this query.

(click on this box to dismiss)

How long between a question is asked, and the answer arrives....

Lifehacks

Q&A for people looking to bypass life's everyday problems with simple tricks

-- measure from the answer time, not the question time.
-- this implies certain things, more to follow.

declare @history as int = - ##Weeks:int?60##
declare @zombie as int = ##Zombie:int?30##
;

with QandA as (
    select p.Id,
           p.CreationDate as QDate,
           min(a.CreationDate) as ADate
    from Posts p,
         Posts a
    where p.Id = a.ParentId
      and p.PostTypeId = 1
      and a.PostTypeId = 2
      and a.ClosedDate is null
      and p.closedDate is null
      and a.CreationDate >= convert(Date, DateAdd(week, @history, CURRENT_TIMESTAMP))
    group by p.Id, p.CreationDate
), AnswerWorking as (

    select DATEADD(DAY, 7 - DATEPART(WEEKDAY, CONVERT(DATE,ADate)), 
                   CONVERT(DATE,ADate)) as WeekEnd,
           convert (Decimal(8,2), DateDiff(minute, QDate, ADate)
                   / Convert(float, 60)) as Delay
    from QandA
), AnswerDelays as (
    select WeekEnd, Delay as QuickDelay, null as ZombieDelay
    from AnswerWorking
    where Delay <= 24
    UNION ALL
    select WeekEnd, null as QuickDelay, Delay / 24 as ZombieDelay
    from AnswerWorking
    where Delay > 24
    
)
   
select WeekEnd as WeekEnd,
       Avg(QuickDelay) as QuickDelay,
       Stdev(QuickDelay) as QuickStdDev,
       Count(QuickDelay) as QuickCount,
       Avg(ZombieDelay) as ZombieDelay,
       Stdev(ZombieDelay) as ZombieStdDev,
       Count(ZombieDelay) as ZombieCount
       
from AnswerDelays
where WeekEnd < CURRENT_TIMESTAMP
group by WeekEnd
order by WeekEnd


--select count (*) from QandA

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results