26

Asking a good question on Stack Overflow can be tough, especially for new members.

How many users' oldest recorded questions are currently not closed, have no downvotes, and have at least one upvote?

If you used the Stack Exchange Data Explorer or some other method, I'd enjoy learning how you got the number too.

14
  • 5
    Well, yours does on Meta ...
    – pppery
    Commented Jul 1, 2022 at 3:08
  • 14
    This isn't possible through SEDE because deleted posts are scrubbed. The best you could do is search for oldest un-deleted post which would be a different metric than the one you are asking for.
    – Henry Ecker Mod
    Commented Jul 1, 2022 at 3:09
  • I tried to edit the question to make it easier to answer, but it still assumes that SEDE query results include all deleted posts and their UIDs and creation dates. I'm open to considering a different metric for what a "good" first question is Commented Jul 1, 2022 at 3:43
  • 7
    I don't think even the greatest SEDE wizards will be able to pull this off. (shush quiet. This is a tactic, I'm making them jump out of the woodwork).
    – Gimby
    Commented Jul 1, 2022 at 8:32
  • 1
    @HenryEcker We can approximate, if we suppose that effectively all deleted posts were asked by a first-time asker. I suspect this isn't that far from the truth. - Actually wait. I might not be thinking straight about this. Hmm. Commented Jul 1, 2022 at 10:27
  • Do you need the absolute numbers? Or just relative ones? Commented Jul 1, 2022 at 11:00
  • @PeterMortensen I'd appreciate both, but relative would be preferred Commented Jul 1, 2022 at 15:36
  • All deleted posts are "sensitive data" UNLESS they have been un-deleted by the user. The question has been reworded, so now there's no need to consider deleted posts. Commented Jul 1, 2022 at 15:43
  • What happend to your user avata usr @NullPointerException ?
    – TGrif
    Commented Jul 1, 2022 at 21:48
  • 5
    @TGrif my money's on a null pointer exception. Commented Jul 2, 2022 at 6:42
  • But seriously, it looks like a link to an image hosted on a googledrive. Never tried it, so I'm not sure how well that's going to render. Commented Jul 2, 2022 at 6:45
  • 1
    "have no downvotes, and have at least one upvote?" Is this a good metric. I would be happy with a positive score and not closed. Commented Jul 3, 2022 at 21:19
  • 2
    I don't know about this "no downvotes" criterion; I've seen plenty of good questions with one or more downvotes. Commented Jul 5, 2022 at 23:05
  • @adabsurdum I agree. I've seen a lot of good questions still get downvotes, so I can see how a net positive score can be a better metric. Commented Jul 6, 2022 at 3:51

1 Answer 1

23

39.2% on 2022-07-03, out of 4.582m first posts.

This does not include deleted posts (only the first post non-deleted post). It does not include users who did not post at all. It only counts first questions, not answers or any other type of post.

The query is as follows:

SELECT
  GoodFirstQuestions    = COUNT(IsGoodQuestion),
  NotGoodFirstQuestions = COUNT(*) - COUNT(IsGoodQuestion),
  TotalUsers            = COUNT(*),
  PercentUsersGoodQ     = COUNT(IsGoodQuestion) * 1.0 / COUNT(*)
FROM (
    SELECT
      p.*,
      rn = ROW_NUMBER() OVER (PARTITION BY p.OwnerUserId ORDER BY p.CreationDate)
    FROM Posts p
    WHERE 
      p.PostTypeId = 1
) p
LEFT JOIN (
    SELECT
      v.PostId,
      upvotes = COUNT(CASE WHEN v.VoteTypeId = 2 THEN 1 END),
      downvotes = COUNT(CASE WHEN v.VoteTypeId = 3 THEN 1 END)
    FROM Votes v
    WHERE v.VoteTypeId IN (2, 3)
    GROUP BY 
      v.PostId
) v ON v.PostId = p.Id
CROSS APPLY (SELECT IsGoodQuestion =
   CASE WHEN p.ClosedDate IS NULL AND
      v.upvotes > 0 AND
      v.downvotes = 0
    THEN 1 END
) calc
WHERE p.rn = 1;

SEDE link

Took a few goes to get this to run without timing out, but the execution plan looks OK now.


  • Begin by taking all Posts with PostTypeId=1 i.e. a question.
  • Compute a row-number, partitioned by OwnerUserId and ordered by CreationDate of the post.
  • Left-join grouped up Votes for the post
    • VoteTypeId IN (2, 3) meaning up and down-votes respectively
    • Pivot them up per post using conditional COUNT
  • Create a virtual column IsGoodQuestion
  • Filter by Row-Number = 1
  • Finally do a total count and percentage.

@Trilarion's comment helps us a lot. Roomba deletes most bad posts within 7 or 30 days.

So looking at only data since last Monday (SEDE refreshes every Sunday morning), we get the following result:

12.3% on 2022-07-03, out of 10,196 first posts in the last week

SEDE link

These numbers make far more sense, given the sheer volume of **** that comes into Stack Overflow on a regular basis.

There is a possible bug here if you try this yourself: make sure you first work out all users' first posts by row-number, before you filter down by date, otherwise you will only get the first post of a user in that week.

14
  • 2
    That is unexpected high. I would have guessed a sub 20% number. Now I wonder if deleted posts are brought into the equation if that percentage comes closer to my gut number.
    – rene
    Commented Jul 3, 2022 at 15:02
  • I would expect so, but it's impossible to get that info on SEDE. Commented Jul 3, 2022 at 15:06
  • 7
    Yeah, maybe we can lure a CM into running this on the internal SEDE instance.
    – rene
    Commented Jul 3, 2022 at 15:07
  • So... 60% of surviving first questions aren't good? For every good first question we keep two garbage ones? That's... pretty bad, I would say. Commented Jul 3, 2022 at 18:58
  • 2
    Well a question that had no upvotes or downvotes might be OK, equally you might have one downvote and 10 upvotes. So looking purely at total score and whether it's not closed is 85% data.stackexchange.com/stackoverflow/query/1612772/… So it just depends how you define good. Commented Jul 3, 2022 at 19:43
  • 4
    I think that this definition of "good" is a bit narrow @MisterMiyagi No downvotes is a fairly extreme measure of "good" (I acknowledge that this it the request in the question). Based on this metric alone is certainly not a reasonable conclusion that 60% of surviving first questions are "bad". We could also consider any positively scoring questions (score > 0) to be good and this would increase the percentage. Additionally closure is not always an indication of a poor question. We have some very useful questions closed as duplicates which route thousands of views toward canonical resources.
    – Henry Ecker Mod
    Commented Jul 3, 2022 at 19:43
  • 3
    Roomba deletes negatively scored questions after 7 and 30 days I believe. So maybe restrict search questions asked in last 6 days? Commented Jul 3, 2022 at 21:21
  • @rene Trilarion has a good point about Roomba, and the data backs this up, see edit Commented Jul 3, 2022 at 21:59
  • @Trilarion Indeed, see new edit Commented Jul 3, 2022 at 22:02
  • 3
    It would be cool to see how this compares to "experienced" users. Like, maybe a similar query, but for the most recent questions asked by users with 1k+ rep.
    – Joundill
    Commented Jul 4, 2022 at 2:33
  • Many of these questions still have zero votes on them. They could be good or bad or simply denote them as neutral. Good=positive score and not closed, Unknown=no votes, not closed, Bad=everything else. Also if you like, show the same for second question, third question (within the last week), ... is there an upwards trend? Commented Jul 4, 2022 at 5:46
  • 1
    @HenryEcker As of 7/5/2022, If a "good" question is open and has a positive score, 42.5% of users' first questions are good (data.stackexchange.com/stackoverflow/query/1613327), 13.1% in the past week (data.stackexchange.com/stackoverflow/query/1613329) Commented Jul 5, 2022 at 16:02
  • 3
    @NullPointerException with the asterisk that the first query has a very heavy survivorship bias.
    – Braiam
    Commented Jul 5, 2022 at 21:00
  • FWIW Some people do not downvote due to the rep penalty to do so but also to avoid the "why did you downvote me" which sometimes (always?) has a subjective reasoning and context of voter experience on the technical topic but also within SO. Commented Aug 8, 2023 at 16:09

You must log in to answer this question.

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