Category Archives: T-SQL Tuesday

What convinced me that diversity is important?

T-SQL Tuesday Logo
For this month’s T-SQL Tuesday, we are to write about a time we changed our minds on something. For me, something  I think about often is that 12 years ago I didn’t value diversity. Today I do value diversity, and if we want to persuade others, we have to figure out what changed.

Where was I 12 years ago?

Twelve years ago, I was going to college and I experienced a bit of a culture shock. The county I’ve lived my entire life in, Beaver County, is 92.5% white and 6% black. The local college I went to, Penn State Beaver, was decidedly more diverse from a racial standpoint.

I remember quite clearly thinking at that point that there had only been 3 times in my life when I had seen that contrast: college, travel stations, and visiting Washington D.C. The rest of my life was in this monoculture.

And when I say that I didn’t value diversity at the time, it wasn’t that I was against it or had negative feelings. It was just that I didn’t see a lack of diversity as a problem. I had a vague awareness that my IT classes were heavily white and heavily male, but that didn’t register as an issue.

Looking back, I think I figured that if different people had different natural talents or natural interests, then what was the harm in that? Part of the reason I was in IT was the things I was bad at. I was bad at people and interacting with them.

Bound up in the previous paragraph were a whole host of assumptions and naïve ideas. The idea that life was a meritocracy. The idea that people freely chose their profession, without discrimination.

What is your ethical structure?

On subjects like this, we often talk past each other. Sometimes in bad faith, but often because we are starting from different ethical precepts. In college I took an Ethics in Computer Science course and learned of two big terms: Utilitarian Ethics and Deontological Ethics.

Essentially, are things right or wrong because of the consequences or because of something inherent to the action? I think one example was “Is it wrong to clean your toilet with the American flag?”. Many people would say yes, but they would have trouble pointing to how anyone was visibly harmed by the act.

I mention this because I think a number of people that are supporting diversity do so from a strongly deontological perspective. So if less than 50% of CEOs are women, then that is in its very nature unjust or unfair. Regardless of the specific consequences.

I think this is a valid and reasonable viewpoint. But I also don’t think that this alone would have changed my mind. Generally I was more swayed by empathy for individuals and seeing concrete negative consequences.

What changed my mind?

I think there were a number of things that all changed my mind in little bits and pieces.

Monoculture leads to failure

Something that planted the seeds early on for me were stories of how having a monoculture of life experiences lead to failure. How HP webcams couldn’t follow black people. How Apple stores had glass staircases. How websites often don’t support names with umlauts or other markings because of assumptions about how names work.

I also learned about groupthink and the often exaggerated Asch conformity experiments. So often these failures occurred either because everyone thought the same or had the same background. Or people were afraid to speak up and stand out.

Life is not a meritocracy

For all of my schooling, I did fairly well. And there was a fairly stable correlation between how good I was at a given task and the grades I got. It seemed to me like school was a meritocracy and I expected work to be the same. I was woefully wrong.

I got a job at Bayer Material Science after college and after 8 months I was fired. I deserved to be fired and wasn’t particularly good at my job. Still, as someone used to getting A’s this was pretty shocking to me.

I learned a number of things during that process. I learned that how well we excel in certain areas can depend on a number of secondary factors, like our ability to work with others, to communicate, etc.

I learned that my skills at being a student didn’t necessarily translate into being a good worker, and I could infer the reverse must be true. There were undoubtedly people who flunked out of school but where crushing it in the workplace.

Violence, discrimination and bias are common

As far as I’m aware, I’ve never been racially or sexually discriminated against. If I have then the person did a terrible job of it, because I didn’t notice. Every police ticket I’ve gotten has been valid. I rarely have to worry about my safety when walking alone at night.

Again, in college I had some vague awareness of this. I understood the idea that my female friends might appreciate someone walking them to their car when it is dark. But I didn’t appreciate just how constant it was for some people. Heck, if I’m being honest, the #MeToo movement was shocking for me to see how many people close to me had been sexually assaulted.

It was helpful too to realize that bias can be invisible, implicit or even well-intentioned. I remember reading about implicit bias in a book and being frustrated about the implicit bias I had in regards to African Americans. I kept failing the test.

I remember meeting an internal salesperson at my last job and saying “Oh so you work in staffing?”, because I had this idea that all sales people were pushy and that women had better people skills, so clearly this person must be a staffing salesperson, not hardware or IT Services. That was 5 years ago and I still feel like an ass to this day.

Representation matters

So I’m going to talk about a type of diversity that may sound strange, but is very meaningful to me. I’m a Type 1 diabetic. And when I was diagnosed, in many ways I felt like my life was over. There were so many things I wasn’t going to be able to do. For the entirety of my last job, I told very few people because I feared I would get fired.

But one of the best things I did was subscribe to Diabetes Forecast magazine. Because in every issue they had a story of someone with diabetes doing something badass. Like racing, or mountain climbing or even winning a beauty pageant. These people weren’t letting diabetes stop them from living their lives.

For this same reason, Scott Hanselman is a hero of mine. He is very openly a diabetic and will present to hundreds of people without letting his diabetes stop him. If he has to check his blood sugar on stage or drink some orange juice, then so be it.

I say all of this to say that representation matters. My life was impacted because I saw myself in successful people. I saw myself in others.

It doesn’t take a colossal leap of empathy to imagine how I might feel if roles were reversed, if all the speakers at a tech conference were female or non-white. If that happened enough, I would quickly internalize the idea that I would never succeed, that I would never make it, that I would never get up on that stage.

If you optimize for individuals, you optimize for assholes

When I see a backlash against people trying to re-balance the scales, a lot of that backlash makes perfect sense under a certain set of assumptions or axioms.

If you believe that 1) the world is or should be a meritocracy and 2) we have an objective way to measure “skill” and 3) we should focus solely on the merits of the individual, then it’s reasonable to conclude that picking anyone but the “best” for a job is an injustice.

And while I think I believed all of those things in college, given my experiences since then, I no longer believe those things.

I’ve learned that often people fail for reasons completely outside of their control. I’ve learned that technical prowess is a minimal part of my job, and there are a plethora of other factors that make me good at my job. I’ve learned that when you narrowly look only at the individual, there are negative consequences both inside the team and outside of the team.

When you optimize for individuals, you optimize for assholes. We’ve all heard the story of person X who delivers results but is inherently toxic and drives others away. Throwing other people under the bus can be a great way to get results in the short term. We have to look beyond the individual.

I think any person in a place of power such as a manager or conference organizer, needs to look not just at the talent or popularity of the individuals, but the mix as a whole and the benefits diversity brings. We can disagree on to what degree, but it needs to be done.


I won’t pretend I have all the answers here. I still haven’t figured out when being pro-diversity swerves into being pro-tokenism, for example. I haven’t figured out that line where in trying to promote a group you accidently reduce them to a name, an identifier, a statistic.

But I can say that these are the things that have helped me value and appreciate diversity. And I hope we can all promote it, even if in small ways.

T-SQL Tuesday #114 – An Unsolved SQL Puzzle

This week’s T-SQL Tuesday invitation is all about puzzles. I’ve got an accidental puzzle that I’ve never quite solved, from one of my demos. I’m sure the answer will be a “Well duh!” moment.

I give presentations on SQL Server execution plans. As part of that, I like to show that if you pull a single row from a heap, it has to read everything. As part of that demo, I try to push everything out of memory by disabling readahead reads, taking a checkpoint, and dropping clean buffers. But for some reason… it never quite works!

FROM    sys.schemas
WHERE   name = N'Demo' )

IF OBJECT_ID('Adventureworks2014.Demo.Person', 'U') IS NOT NULL
DROP TABLE AdventureWorks2014.Demo.Person;


INTO [AdventureWorks2014].[Demo].[Person]
FROM [AdventureWorks2014].[Person].[Person]

DBCC TRACEON (652,-1);


SELECT * FROM [AdventureWorks2014].[Demo].[Person]
WHERE BusinessEntityID = 25

You can see here that it shows 3,808 logical reads, but 5 physical reads.

Screen shot of statistics IO showing the number of reads.

I’m sure there is some simple way to force it to do all of the physical reads, but I have yet to figure it out. Or it may be that I’m misunderstanding something and physical reads are the only pages used. But when I look at the execution plan, it says it read all of the rows.

I’d love to get an answer to this puzzle. I’m sure it’s something simple.

Update: Andy G. asked if maybe the issue is I’m not using all the rows. Here I tried a heap of a single row, and I get 1 logical read and 0 physical reads.

Table 'Person'. Scan count 1, logical reads 1, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

T-SQL Tuesday #113: A year of marriage and boardgames

T-SQL Tuesday Logo

This week’s T-SQL Tuesday is about where you use databases in your personal life. And I have a database I don’t use any more that’s a little happy and a little sad. For the first year of my marriage, I would track every time we played a board game together.


Of course, some may question if it was really a database. We kept the data in Google Sheets. It was ugly data; if we played multiple games in a day, I didn’t always put in all the dates. I didn’t always spell games the same way. I had different entries for which configuration of Star Realms we played, even though it was the same game.


One thing that was really useful was seeing which games Annie kicked my butt at. Or to see which games we played the most. Magic the gathering is in there twice because I did’t always spell it the same way.


After a while, we didn’t play quite as frequently and all the data entry started to wear on me. I even played around with making a PowerApp to make it easier.


In the end though, I stopped keeping track. Maybe at some point I’ll start again. I find it strangely satisfying to have this bizarre log of the first year of my marriage. During that time, we played about 90 distinct games about 220 times. We had a lot of fun and still dedicate 9 PM to 10 PM as our date hour, but will watch movies or play video games too now. And ultimately, we started what has been the best decision of my life, which was getting married.

T-SQL Tuesday #111 – What is your why?

For this T-SQL Tuesday, Andy Leonard asks us, “What is your why?”, why do you do what you do?

Many of the answers from others are heartfelt and admirable. Mine are not. Most fall under the category of either dumb or dumb luck.

Starcraft and Scholastic

My very first taste of programming was back in first grade or so with LOGO. I thought it was a lot of fun but never did any significant after that. I first got my second taste of programming with Starcraft custom maps. The year was 1999. I know this because my username was eugene11.  I’ll let you do the math. Starcraft had a scripting logic that was basically a simple if/then system.

But the day I became a true programmer was when looking in the back of a scholastic catalog, I found Interplay’s Learn to Program BASIC! The description promised to teach me how to make video games.
Interplay's Learn to Program Basic - Junior High Edition (Windows 95/Mac OS Required)

It was pretty easy to follow along with the lessons, although I didn’t truly understand what I was doing.  I could make small modifications to the games they provided but didn’t understand half of the logic therein.

In high school I would make video games on my graphing calculator, because I was bored. I also participated in a game jam called PyWeek.

Brothers and ex-girlfriends

When I went to college, I figured I’d either be a programmer or a professor. I went to Penn State beaver because it was close, cheap and my brother graduated there, so I already knew one of the professors.

In my senior year, I needed to take an elective in my major. I took Business intelligence, because the other option didn’t work with my girlfriend’s schedule. Remember when I said some of the reasons were dumb?

Later on I asked the professor for a job. He worked full time as the head of Business Intelligence at Bayer Material Science. He hired me and I worked there for a year. Ultimately, though, it wasn’t a good fit.

My next job was labeled .net/SQL developer. But after I was accepted I realized it was 90% SQL and suddenly I was a DBA and the new BI department. This part falls under the dumb luck, and it was lucky. I was in a role that I could grow into and over the years ended up working as a BI consultant within the company.

While much of the path to BI was an accident, I’ve stayed with it in part because of the strong community and the friendships I’ve made. I really wonder if I’d find a community as strong and giving as #sqlfamily in a different field. But also, if I’m being honest, because the opportunity cost is high and this is a well-paying profession.

Mom and my new adventures

My career for past 7 years has largely been an accident. I’ve always loved computers and thinking, but I can hardly say I chose this field. But back in September, I quit my job to work for myself. I did this to work on my physical health, my mental health, and have more control over my career.

And honestly, why not? Worst case I have a gap year on my resume, and I go back to get a regular job, right?

I’ve written about the lessons learned so far and more recently, I’ve discovered another why. Working for myself allows me the flexibility to take care of my mom. And so why not becomes much more of a why.

T-SQL Tuesday #110–Automation is relative

The theme for biggest failure of my career, I wrote that I would have automated things more. What was that automation? Nightly ETL with stored procedures, maybe SSIS + BIML if I was smarter. If I was doing the project all over, it’d wouldn’t be called automation it would be called best practices!

So, what project would I definitely call automation that I have done? Well I can only think of one project, and it’s pretty silly. 4 years ago, I was using the Raspberry Pi as my main computer. Over the past few years I’ve tinkered with the Raspberry Pi and I’ve built some dumb BASH scripts to install and configure a new install of the OS.

It’s not fancy or impressive, but it makes my life easier and I’m happy with it. In the future I’d like to do something similar with windows so I can spin up a whole Hyper-v lab without any work.