The Boring but Useful - The extreme Type B popular posts.

1

Please login or register to vote for this query.

(click on this box to dismiss)

Posts that are "boring", but are extremely "useful".

Ask Patents Meta

Q&A about the site for people interested in improving and participating in the patent system

-- "Boring but Useful" - Extreme Type B popular posts from:
-- http://data.stackexchange.com/stackoverflow/query/109257/popular-posts-type-a-vs-type-b


-- Type B Popular Posts:    (Variance Index < 20)
--   Type B's are those that slowly and steadily receive traffic over time.
--   Type B's get nearly all their trafffic from a steady source such as:
--   Search Engines, top questions list, or Jon Skeet's profile.

--   The vast majority of Type B's are generally less interesting, but are very
--   useful to developers who come across the same problem in the question.
--   They are usually upvoted because they are "helpful".


declare @minAge numeric = 30

DECLARE @endDate date
SELECT @endDate = max(CreationDate) from Posts

SELECT top 1000
    (CASE tmp.posttype
        WHEN 1 THEN 'Q'
        WHEN 2 THEN 'A'
     END),
    tmp.[Post Link],
    tmp.[User Link],
    tmp.[Age],
    tmp.score AS [Score],
    Max(tmp.dVotes) AS [Vote Spike],
    Cast((STDEV(tmp.dVotes) + 1) / SQRT(SUM(tmp.dVotes)) * 100 AS DECIMAL(20,5))
        AS [Variance Index],
    Cast(STDEV(tmp.dVotes) + 1 AS DECIMAL(20, 3))
        AS [Type A],
    Cast(tmp.score / (STDEV(tmp.dVotes) + 1) AS DECIMAL(20, 3))
        AS [Type B]
FROM

-- Subquery forked from:
-- http://data.stackexchange.com/stackoverflow/query/108188/upvotes-per-post-and-per-day
    (SELECT
      p.PostTypeId AS posttype,
      v.PostId AS [Post Link],
      p.OwnerUserId AS [User Link],
      v.CreationDate AS [Date],
      DATEDIFF(DAY,p.CreationDate,@endDate) AS [Age],
      Count(*) AS dVotes,
      p.score AS score
    FROM Votes v
    LEFT JOIN Posts p ON p.Id = v.PostId
    WHERE
        DATEDIFF(DAY,p.CreationDate,@endDate) >= 30 and
        v.VoteTypeId = 2 and p.PostTypeId is not null
    GROUP BY
        v.PostId,
        v.CreationDate,
        p.CreationDate,
        p.OwnerUserId,
        p.PostTypeId,
        p.Score
    ) AS tmp
    
WHERE tmp.score > 0
GROUP BY
    tmp.[Post Link],
    tmp.posttype,
    tmp.[User Link],
    tmp.score,
    tmp.[Age]
HAVING
    COUNT(tmp.dVotes) > 1
ORDER BY [Type B] DESC

Enter Parameters

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