Data with Bert logo

My Most Embarrassing SQL Moment

T-SQL Tuesday #92: Lessons Learned the Hard Way

55ae8-1lh0mvkliatliiikt0vlyow

This post is a response to this month's T-SQL Tuesday prompt. T-SQL Tuesday was created by Adam Machanic and is a way for SQL users to share ideas about interesting topics. This month's topic is Lessons Learned the Hard Way.


Watch this week's video on YouTube

"Is this your query that's killing the server?"

It was my first week on the job and I was learning to query one of our major databases.

Up until that point, my SQL experience was limited to working on a *tiny* e-commerce database. Query performance was never something I had to deal with because any query I wrote, no matter how poorly written, would always execute quickly.

This new database I was working on though had tables with a billion+ rows. I should have been more conscious about how I was writing my joins and filtering my records, but I wasn't. I wrote my query and executed it in SQL Server Management Studio.

About 20 minutes into my query's execution, I received an email from my new DBA, and it looked something like this:

Uhh, there might be a problem here

"Is this your query that's killing the server?"

Oops.

I don't think my mouse ever moved to the stop execution button as quickly as it did that moment.

I was incredibly embarrassed to have brought our production server to a crawl. I was also incredibly embarrassed to have had my first interaction with my new DBA be about a query that created major problems for him.

Although there were no long-term damages from my server-crushing query, it was a scenario that I definitely didn't want to relive again in the future.

Next time: don't do that again

Obviously, this was an experience where I learned that maybe I shouldn't write queries against unfamiliar data in production.

  • I should have been practicing on a dev database.
  • I should have looked at table meta data and made sure I understood relationships between tables better.
  • I should have done some more preliminary querying with more restrictive filters to be able to catch performance problems earlier on with smaller result sets.
  • I should have examined what indexes were available and made sure I was attempting to use them.
  • I should have used a (NOLOCK) if I absolutely had to test on the production data so that at the very least I wouldn't prevent the high transaction ETLs from modifying data in that database.

All of those "should haves" quickly became my checklist for what to do before running any query in an unfamiliar environment.

I've still written plenty of ugly and inefficient queries since then, however none of them ever caused me to bring the SQL server to a halt like I did in my first week. That was one lesson that I learned the hard way.

Behind the Scenes of an Online Presentation

Charlie is an attentive audience member

Last week I presented my session "DBAs vs Developers: JSON in SQL Server 2016" at the online GroupBy Conference.

As I prepared for the event, I thought about all of the things that were different about getting ready for an online versus an in-person event.

Thinking that others might be interested in seeing what I do to get ready for an online talk, I filmed myself as I prepared for presentation day and put together this "behind the scenes" video.

Check it out, along with my actual talk on JSON in SQL Server 2016, in the videos below!

https://www.youtube.com/watch?v=oDYCSym6Lko

Slides and demo code from the presentation is available at https://bertwagner.com/presentations/

And the presentation video itself:

https://www.youtube.com/watch?v=WJpUGHWUMoc

And slide deck:

https://www.slideshare.net/BertWagner/dbas-vs-developers-json-in-sql-server-2016

[Video] JSON Usage and Performance in SQL Server 2016

Using JSON because you are lazy is not a good excuse!

Last night I had the privilege to present to the Ohio North SQL Server User Group about JSON in SQL Server 2016. There was a great crowd present (they laughed at all of my terrible jokes so how can they not be great!?) and I had a wonderful time sharing what I know about JSON.

Below you can find my video recording of the presentation as well as the slides and demo code.

Also worth highlighting is OnTopReplica, an open source piece of software I used that basically does picture-in-picture display of another window on your desktop. You can hear everyone get excited by it at 18 minutes and 30 seconds into the video.

Enjoy the resources below :). These as well as resources from other past presentations are available at https://bertwagner.com/presentations/ .

Video

https://youtu.be/r2xFIsdSJ2Q

Slides

https://www.slideshare.net/BertWagner/json-usage-and-performance-in-sql-server-2016

Demo Scripts

https://bertwagner.com/presentations/JSON%20in%20SQL%20Server%202016%20-%20Bert%20Wagner.zip

Present Like Nobody's Watching

Presenting online — more like a one-on-one discussion than a presentation in front of hundreds of people

Last week I presented my session High Performance SSRS at the inaugural GroupBy Conference. It was an incredibly fun experience getting to present a topic I'm excited about as well seeing others do the same at such a high caliber.

The thing that makes GroupBy different from other technical conferences is that it's free, it's community driven, and it's online-only. This makes it a very inclusive conference since barriers to attend are extremely low. The only significant barrier to watching the sessions live was a software restriction to the amount of live attendees. Fortunately, all of the sessions were made available on the GroupBy YouTube channel soon afterwards to allow anybody to watch the sessions at any time.

The 1,000 live attendee registration cap was quickly reached

Even though the conference is only half-over (more excellent presentations coming this Friday January 20 — go register!), my session is complete so I thought it would be fun to go over what made presenting at GroupBy different from an ordinary in-person conference.

Pre-Conference

There wasn't too much of a difference preparing for GroupBy compared to other speaking engagements. I still had to create a presentation that captured the audience's attention and told a good story. I also had a lot of rehearsing to do, especially since my presentation consisted of mostly live demos. In case you've never presented something with live demos, here's a secret: something always goes wrong. This means a lot of my preparation involved thinking about what could go wrong and trying to prepare for it so I wouldn't embarrass myself too badly in front of a live audience.

The main difference between this talk and others I've given is that I was entirely on my own in regards to audio and video setup.

Broadcasting from my kitchen on conference day

Having a both an audio (musician) and video (photographer) background, I probably went a little overboard with my setup. During my practice recording sessions, I kept finding little details that annoyed me and forced me to get to the setup that you see above. Ugly background? Move to the kitchen where there is a solid white wall. Bad lighting? Turn on all of the lights and bring in extra lamps. Laptop microphone sounds muffled? Pull out the condenser and boom stand.

Conference Day

Since I didn't have to travel anywhere to speak, I just went about my normal day and went in to work. We booked a conference room (zing!) and had a watch party, ate some pizza, and learned about SQL Server 2016 built-in performance boosts, automation with PowerShell, SQL at StackOverflow, SQL Server 2016 hidden gems, what not to do with SQL, and Power BI. During the lunch break, I went home to get ready for my session.

My actual session went well and was strangely comfortable to present since I got to do it in my home, in my regular programming chair, 3 feet away from my regular programming fridge (need caffeine from somewhere right?).

The one daunting aspect of my presentation was that it was difficult getting a sense of how the audience was following along. Although Brent was great at laughing at my jokes, commenting, and moderating audience questions, it was hard for me to judge if I needed to speed up sections or slow down and explain in more detail. With a live audience, I can read body language and adjust. Online, it felt like nobody is watching.

Post-Conference

People were watching however, because soon after my presentation was over I got flooded with texts, emails, and comments about my session. Session ratings flowed in over the next few days and I was happy to get feedback indicating that my session was well received.

And although there were no speaker dinners or sponsored after parties, Renee and I made up for it by going to our favorite sushi bar to celebrate!

Presenting in the virtual world was definitely a very different experience for me but I loved it. Would I do it again? No doubt, and I hope you do too (abstract deadline is February 28 — get typing!).

Epic Life Quests

ff87c-0a7-0aztlscfuxve_

It is easy to get caught up in the daily details of life and not take the time to reflect on longer term goals and accomplishments.

Inspired by Brent Ozar and Steve Kamb, these Epic Life Quests are intended to help me reflect on my accomplishments and help me stay focused on the things that are important.

Each level contains five achievements and once all are completed I can "level up" to the next five. Follow along and let me know if you create any epic life quests of your own.

Level 2 (currently working on)

  • Blog weekly for 6 months straight — Last year I began blogging more than any previous year, but I didn't always stick to a schedule. My biggest problem was I didn't know what I wanted to write about so choosing topics was difficult and frustrating. After looking back at what posts were the most well-received, I've decided to focus the first half of 2017 to mostly technical and professional development type topics.
  • Speak at a technical conference — I've been presenting technical content in small user group type settings for years but this year I want to try my hand at some larger audiences. Completed January 2017 at the GroupBy conference.
  • Vacation in Hawaii — Our vacations in 2016 focused on places we could reach by car so that we could save some money for a larger trip. This will be the bigger trip. After visiting Hawaii, I will have visited 36 states + Washington D.C (airports don't count!).
  • Work on mental mindfulness— practice meditation to improve focus, patience, manage stress, be happier. I want to average at least 5 days/week for 3 months to reach this goal.
  • Always be reading at least one book — Although I read 40+ books in 2016, there were stretches of weeks at a time where I was not reading anything. For 6 months I don't want to go more than 3 days without having picked a book to have available to read.

Level 1 Quests (completed before 2017)

Here are some of my achievements before I started this page on January 1, 2017.

  • Set up an environment for programming regularly at home — completed 2016
  • Start using GitHubt for my coding projects — completed 2016
  • Built a hardware project that gets regular use (not just proof of concept) — completed 2016
  • Buy a house — completed 2015
  • Get into backpacking — completed 2015
  • Take a car trip in Europe with Renee — completed 2015
  • Learn to read books for pleasure — completed 2014