Funny that it’s these T-SQL Tuesday posts that lead me to post a blog. I have a bunch of unfinished drafts, but now I have the chance to rework an entry about a particular hobby or two. So let’s talk about it.
Aaron Bertrand (b|t), an early name I remember some 4-5 years ago when I first heard the concept of a Microsoft Data Platform community, presented this topic – a dealer’s choice between non-tech hobbies we are passionate about, and T-SQL bad habits. What better way to get to know people than the former, and how to learn via the latter? Well, I’m going to go through door #1 while also using analogies to peek at door #2.
“Oh geez, not another #SQLRun person.”
As a resident of the Research Triangle area of North Carolina, I have yet another community I am a major part of: the Triangle running community. I’m not the first “SQL Runner” around, as I recall from Twitter handles and the early morning run held at PASS Summit. However, I’ve upped my running habits to new levels since life changing events in 2013, and only over the last year did it increase exponentially. The fun is derived from participating with friends and reaching personal goals simultaneously.
In November, I ran my first full marathon. In December, I hit a sub-7:00/mile pace in a 5k (which I wasn’t planning on). Come the final day of the year, I surpassed 1,250 miles for the first time. As I was regenerating this post, I was part of an awesome four-person team in a marathon relay (1.5-mile loops around a park, four times each). I have shirts from various run clubs in the area, from the one my fiancee organizes, to the nonprofit institution in Raleigh, after attending enough times to earn my stripes. I met a lot of new friends through this hobby which drives us to test our physical limits as we get older. Running is a good “team sport” more than people realize because you test your own individual limits but can also enjoy company when practicing via casual runs or challenging pace runs.
A bonus is getting some sweet poses for the camera.
The other great aspect is tying in projects you care about with the running hobby. I am hoping to return to volunteering/participating in Triangle RunWalk for Autism, which I took part from 2013-16. As a volunteer with ASNC, the cause is what makes this race special. It’s the same with the nOg race series. Everything goes to charitable causes. It’s more important than winning prizes, although those are nice…
However, running is also a really serious business if you’re into racing and keeping yourself going (see above). It can be easy to fall into bad habits, like not stretching afterwards, or not controlling your upper body form while striding. Or missing part of your training plan and trying to jump back in with your long run. Especially if you’re me and running Yuengling Shamrock Marathon in just over one month. It has become a dominant part of the day-to-day, and unfortunately delayed some other professional goals I want to achieve. Again, working on this means cutting our bad habits.
What’s behind the other door this month?
Same can be said for bad habits in the field where I butter my bread on a daily basis. While writing this post I have thought about atrocities which I have committed in the past, and addressed in my analyst-to-developer presentation. I love FORMAT() and all, especially when a field has a bad type, but lately I’ve found out that it can be deceptively long in terms of overhead. The best example I can point out right now is an instance two months prior where I pulled 1,686 rows, but it took 14 times as long, even if the execution plan did not show it. Since FORMAT() arrived with the 2012 edition, it was like a shiny new pair of running shoes when I first began adding it to all my T-SQL code. Let’s say this new shoe has tested well and may provide stability correction, but what if your feet need neutral sneakers because they supinate? FORMAT() is a fun little piece of code, but it taxes the database and the rows to search the same way those sneakers are a bad fit. You know, like cursors, or using CAST() when CONVERT() makes more sense. To keep with the analogy, getting the right data type for a field is like sizing the foot and its form before getting the shoe to go with it, and datetime is the shoe you need. It’s no secret that some code may look okay when you view the plan, but when you actually get the statistics it’s a different story.
This one may not be on Aaron’s list, but as someone coming from the classic analyst/developer end of the spectrum who never was a DBA, I still forget how costly legacy code is when I’m asked to do something quickly. If it’s being run on the same server as a particular job, said job will crash when I’m running a script that takes 20 minutes but I was more interested in a fresh development task. To tie this point with running, if you run near race pace all the time, trying to maximize the most out of your body [query], then you will likely crash as other parts of your body [processes/jobs] are affected. My personal practice has been to break down the query in sections and chip away at what is wrong based on the execution plan. However, I’d like experts to chime in on better ways to tune next time I enter the Slack channel.
(Last time I did a T-SQL Tuesday I tied in speaking events with training plans! Never gets old!)
I wrote about thrice or so concerning the aforementioned spectrum self-advocacy. Many of us have hobbies that neurotypicals wonder why we know so much about it. Ornithology, geology, filmography. For some reason, I got interested in the production logos at the start of movies and end of television shows. So all I will say is ask me about why I find logo plastering like this annoying:
Not that I was ever a marketing person, but a logo tells us about a brand, and film & television studios have that branding too. How a show is put together and that first or last image of entertainment is pretty important to my own viewpoint, even if the show is the actual important part. There’s a whole community online that does all this research.
So that was door #1. Though speaking of door #2, I do have a post on SEQUENCE and IDENTITY which should be ready next month…someone tell Ubu to sit already.