Skip to main content
Fix preposition and quantifier
Source Link
Audwin Oyong
  • 2.5k
  • 1
  • 7
  • 7

Does that mean a question posted inon the weekend will attract (on average) less attention? Assuming that a fixed percentage of those views are directed towards new questions, the weekend has the advantage that there are lessfewer questions posted, so your question stays longer on the front page. The numbers tell the story, so let's dig into the Data Explorer and find out.

Does that mean a question posted in the weekend will attract (on average) less attention? Assuming that a fixed percentage of those views are directed towards new questions, the weekend has the advantage that there are less questions posted, so your question stays longer on the front page. The numbers tell the story, so let's dig into the Data Explorer and find out.

Does that mean a question posted on the weekend will attract (on average) less attention? Assuming that a fixed percentage of those views are directed towards new questions, the weekend has the advantage that there are fewer questions posted, so your question stays longer on the front page. The numbers tell the story, so let's dig into the Data Explorer and find out.

query is now dynamic
Source Link
Glorfindel
  • 22.6k
  • 31
  • 343
  • 347

For reference, here is the full SQL for the queryquery:

DECLARE @StartDate datetime = '2015-10-01';##StartDate:string##;
DECLARE @EndDate datetime = '2015-10-15';##EndDate:string##;

CREATE TABLE #temp (bucket datetime, average float, std float)

INSERT INTO #temp 
SELECT 
  dateadd(hour, datediff(hour, 0, creationdate), 0),
  avg(viewcount),
  stdev(viewcount)
  FROM posts
  WHERE posttypeid = 1
    AND creationdate BETWEEN @StartDate AND @EndDate
  GROUP BY dateadd(hour, datediff(hour, 0, creationdate), 0)
  ORDER BY dateadd(hour, datediff(hour, 0, creationdate), 0)
  
SELECT
  dateadd(hour, datediff(hour, 0, creationdate), 0) AS 'Bucket',
  avg(viewcount) AS 'Average view count',
  count(*) AS 'Number of questions'
  FROM posts INNER JOIN #temp
   ON dateadd(hour, datediff(hour, 0, creationdate), 0) = bucket
  WHERE posttypeid = 1
    AND creationdate BETWEEN @StartDate AND @EndDate
    AND viewcount BETWEEN average - 2 * std AND average + 2 * std
  GROUP BY dateadd(hour, datediff(hour, 0, creationdate), 0)
  ORDER BY dateadd(hour, datediff(hour, 0, creationdate), 0)

For reference, here is the full SQL for the query:

DECLARE @StartDate datetime = '2015-10-01';
DECLARE @EndDate datetime = '2015-10-15';

CREATE TABLE #temp (bucket datetime, average float, std float)

INSERT INTO #temp 
SELECT 
  dateadd(hour, datediff(hour, 0, creationdate), 0),
  avg(viewcount),
  stdev(viewcount)
  FROM posts
  WHERE posttypeid = 1
    AND creationdate BETWEEN @StartDate AND @EndDate
  GROUP BY dateadd(hour, datediff(hour, 0, creationdate), 0)
  ORDER BY dateadd(hour, datediff(hour, 0, creationdate), 0)
  
SELECT
  dateadd(hour, datediff(hour, 0, creationdate), 0) AS 'Bucket',
  avg(viewcount) AS 'Average view count',
  count(*) AS 'Number of questions'
  FROM posts INNER JOIN #temp
   ON dateadd(hour, datediff(hour, 0, creationdate), 0) = bucket
  WHERE posttypeid = 1
    AND creationdate BETWEEN @StartDate AND @EndDate
    AND viewcount BETWEEN average - 2 * std AND average + 2 * std
  GROUP BY dateadd(hour, datediff(hour, 0, creationdate), 0)
  ORDER BY dateadd(hour, datediff(hour, 0, creationdate), 0)

For reference, here is the full SQL for the query:

DECLARE @StartDate datetime = ##StartDate:string##;
DECLARE @EndDate datetime = ##EndDate:string##;

CREATE TABLE #temp (bucket datetime, average float, std float)

INSERT INTO #temp 
SELECT 
  dateadd(hour, datediff(hour, 0, creationdate), 0),
  avg(viewcount),
  stdev(viewcount)
  FROM posts
  WHERE posttypeid = 1
    AND creationdate BETWEEN @StartDate AND @EndDate
  GROUP BY dateadd(hour, datediff(hour, 0, creationdate), 0)
  ORDER BY dateadd(hour, datediff(hour, 0, creationdate), 0)
  
SELECT
  dateadd(hour, datediff(hour, 0, creationdate), 0) AS 'Bucket',
  avg(viewcount) AS 'Average view count',
  count(*) AS 'Number of questions'
  FROM posts INNER JOIN #temp
   ON dateadd(hour, datediff(hour, 0, creationdate), 0) = bucket
  WHERE posttypeid = 1
    AND creationdate BETWEEN @StartDate AND @EndDate
    AND viewcount BETWEEN average - 2 * std AND average + 2 * std
  GROUP BY dateadd(hour, datediff(hour, 0, creationdate), 0)
  ORDER BY dateadd(hour, datediff(hour, 0, creationdate), 0)
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

No, the number of views for a question is independent from the moment of posting. HereHere are some tips to attract more attention to your question; posting during the work week will not help.

No, the number of views for a question is independent from the moment of posting. Here are some tips to attract more attention to your question; posting during the work week will not help.

No, the number of views for a question is independent from the moment of posting. Here are some tips to attract more attention to your question; posting during the work week will not help.

added 15 characters in body
Source Link
Glorfindel
  • 22.6k
  • 31
  • 343
  • 347
Loading
Source Link
Glorfindel
  • 22.6k
  • 31
  • 343
  • 347
Loading
Post Made Community Wiki by Glorfindel