[Video] Watch Brent Write Queries


This morning, I wanted to write a few new “background noise” queries for my Mastering classes. In those classes, the students run live workloads against the Stack Overflow database and troubleshoot performance issues, and the more of a varied workload I’ve got running, the more realistic it feels. For this session, I specifically wanted to write quick queries – queries that would produce real-world style data in a few seconds, in the style a user would actually write them.

I streamed the whole thing live in Twitch, and you can watch. – or in YouTube if your company blocks Twitch.

If you wanna jump around to different parts of the video, here are the key points where I started new queries:

  • 7min:33sec in: I introduce the topic of what I’m trying to do. The first query fetches the tags a user works on the most often and shows their scores. I happen to run across Gordon Linoff, a prolific answerer.
  • 26m:08sec: I let y’all tell me what queries you want me to write, and then I start working on finding the top tags in a date range.
  • 34m:54sec: I explain why I love COALESCE and how a friend of mine ended up putting a seasickness pill up their butt.
  • 42m:30sec: I code a leaderboard of the top questions with the most answers.
  • 1h:04m: I get a great question about parameter sniffing on update statements, so I code a demo showing it live.
  • 1h:41m: I find the most recent answers from the top 10 most active folks, and explain why you have to use hard-coded dates rather than GETDATE() when working with older Stack Overflow exports.
  • 1h:57m: I write a query to find average response times for a given date range & tag, and build it atop a view to simulate what users would do, and then write another proc atop that view to find the fastest answers in a date range.

Enjoyed this session? Follow me on TwitchYouTube, or Facebook to be alerted whenever I’m streaming.

Here are the scripts from the demo:


Previous Post
Attention Season Pass Holders: New Fundamentals of Parameter Sniffing Videos Available!
Next Post
SQL ConstantCare® Population Report: Spring 2020

3 Comments. Leave new

  • What a shame. My organization has blocked access to Twitch.

    • Ouch. You might have to finally cough up and buy some Internet at home. Trust me, it’s worth it – opens up a whole new world when you can surf on your own time, too.

  • Could only watch it for an hour or so, but will definitely watch it later! Very nice you have Twitch now! By the way, you really have to work on your pronunciation of ‘stroopwafel’. 😛


Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.