A Summit To Remember

There’s been a lot of talk about the 2020 PASS Summit and how the impact of making it virtual this year. I’ve even previously written about it. I’ll be clear, I would prefer an in-person summit. But that said, I think having it virtual does provide for some fascinating and interesting possibilities and I look forward to seeing how they’re handled.  It will certainly be different being able to watch a session at a later time as a default option. And my understanding is that session schedules will no longer be constrained by the timezone the Summit is being held in.

That said, I also have to admit a certain bias here. I’ve wanted to speak at Summit for a couple of years now and have been turned down twice in the past two years. This year I was hoping again to speak, but alas, I procrastinated a bit too long and literally missed the original window to submit by a few hours.

Note I said original window. Because the Summit was moved to a virtual Summit the decision was made to re-open the call for speakers. This time I took advantage of that 2nd chance and submitted a bid.

And I’m so glad I did. Because if you didn’t have a reason to attend summit before, you do now! You get to hear me talk about PowerShell! So, I’ll admit to getting an unexpected benefit out of the move to a Virtual Summit.

I still recall one of my first attempts to use PowerShell at a client site, about 8 years ago. It did not go well. The security policy wouldn’t let me do what I wanted and the available knowledge on the Internet was sparse. Basically I wanted to loop through a list of servers and see if they had SQL Server installed. I eventually gave up on that project.

Since then though, I’ve been drawn to PowerShell and have come to love it. Now, when you hear a DBA talk about PowerShell, they will almost always mention dbatools. I want to go on record right now, I think it’s a GREAT addition, but I rarely use it. Not because there’s anything wrong with it, but mostly because my current usage is a bit different than what it provides. I do talk about it a bit here though.

For the talk I’ll be presenting, my plan is to start with a real simple PowerShell Script and slowly build on it until it’s a useful script for deploying SQL Scripts to multiple servers. For anyone who has read my articles at Red-Gate, much of this will be familiar territory, but I hope to cover in 75 minutes what I cover in 3-4 articles.

Checking this morning, I noticed that I’m among good company, and it’s humbling to see it, when it comes to speaking about PowerShell.

So, I hope you “come” and see me present on PowerShell at SQL Summit 2020. I’ll be in New York, where will you be?

Giving Blood and Pride Month

I gave blood yesterday. It got me thinking. First, let me show a few screenshots:

male blood donor shot 1

7 Male Donor #1 screen shot

female blood donor shot 1

Female Donor #1 screen shot

Let me interject here I’m using the terms Male and Female based on the criteria I selected in the American Red Cross’s Fast Pass screen. More on why I make that distinction further on. But first two more screen shots.

female blood donor shot 2

Pregnancy question highlighted for female

male blood donor shot 2

No pregnancy question for males

Now, on the face of it, this second set of questions especially almost seems to make sense: I mean if I answered Male early on in the questionnaire, why by asked about a pregnancy? But what I’m asked at the beginning is about my gender, not my actual child-bearing capability. Let me quote from Merriam-Webster:

2-b: the behavioral, cultural, or psychological traits typically associated with one sex

Or from the World Health Organization:

Gender refers to the roles, behaviours, activities, attributes and opportunities that any society considers appropriate for girls and boys, and women and men. Gender interacts with, but is different from, the binary categories of biological sex.

Who can be pregnant?

So above, really what the Red Cross is asking isn’t about my gender, but really my ability to be pregnant. Now, this is a valid medical concern. There are risks they want to avoid in regards to pregnant women, or recently pregnant women giving blood. So their ultimate goal isn’t the problem, but their initial assumption might be. A trans-man might still be able to get pregnant, and a trans-woman might be incapable of getting pregnant (as well as a cis-woman might be incapable.) And this is why I had the caveat above about using the terms male and female. I’m using the terms provided which may not be the most accurate.

Assumptions on risk factors

The first set of images is a problematic in another way: it is making assumptions about risk factors. Now, I think we can all agree that keeping blood borne pathogens such as HIV out of the blood supply is a good one. And yes, while donated blood is tested, it can be even safer if people who know they are HIV or at risk for it can potentially self-select themselves out of the donation process.

But…

Let me show the actual question:

Male Male 3 month contact question

Question 21, for Men

This is an improvement over the older restrictions that were at one year and at one point “any time since 1977”. Think about that. If a man had had sex with another man in 1986, but consistently tested negative for HIV/AIDS for the following 30+ years, they could not give blood under previous rules. By the way, I will make a note here that these rules are NOT set by the American Red Cross, but rather by the FDA. So don’t get too angry at the Red Cross for this.

The argument for a 3 month window apparently was based on the fact that HIV tests now are good enough that they can pick up viral particles after that window (i.e. at say 2 months, you may be infected, but the tests may not detect it.)

Based on the CDC information I found today, in 2018, male-to-male sexual contact resulted in 24,933 new infections. The 2nd highest category was heterosexual contact (note the CDC page doesn’t seem to specify the word sexual there.) So yes, statistically it appears male-male sexual contact is a high-risk category.

But…

I know a number of gay and bisexual men. I don’t inquire about their sexual habits. However, a number are either married or appear to be in monogamous relationships. This means if they want to give blood and not lie on the forms, they have to be celibate for at least 3 months at a time!  But hey if you’re a straight guy and had sex with 4 different women in the last week, no problem, as long as you didn’t pay any of them for sex! I’ll add that more than one gay man I know wants to give blood and based on their actual behavior are in a low risk category, but can’t because of the above question.

Why do I bring all this up at the end of Pride Month and what, if anything does it have to do with database design (something I do try to actually write about from time to time)?

As a cis-het male (assigned at birth and still fits me) it’s easy to be oblivious to the problematic nature of the questions on such an innocuous and arguably well-intended  form. The FDA has certain mandates that the Red Cross (and other blood donation agencies) must follow. And I think the mandates are often well-intended. But, there are probably better ways of approaching the goals, in the examples given above, of helping to rule out higher-risk donations. I’ll be honest, I’m not always sure the best way.  To some extent, it might be as simple as rewording the question. In others, it might be necessary to redesign the database to better reflect the realities of gender and sex, after all bits are cheap.

But I want to tie this into something I’ve said before: diversity in hiring is critical and I think we in the data world need to be aware of this. There are several reasons, but I want to focus on one for now.

Our Databases Model the World as We Know It.

The way we build databases is an attempt to model the world. If we are only aware of two genders, we will build our databases to reflect this. But sometimes we have to stop and ask, “do we even need to ask that question?” For one thing, we potentially add the issue of having to deal with Personally Identifiable Information that we don’t really need.  For another, we can make assumptions: “Oh they’re male, they can’t get pregnant so this drug won’t be an issue.”

Now, I’m fortunate enough to have a number of friends who fall into various places on the LGBTQIA+ (and constantly growing collection of letters) panoply and the more I listen, the more complexity I see in the world and how we record it.

This is not to say that you must go out instantly and hire 20 different DBAs, each representing a different identity. That’s obviously not practical. But, I suspect if your staff is made up of cis-het men, your data models may be suffering and you may not even be aware of it!

So, listen to others when they talk about their experiences, do research, get to know more people with experiences and genders and sexualities different from yours. You’ll learn something and you also might build databases. But more importantly, you’ll get to know some great people and become a better person yourself. Trust me on that.

 

 

 

“Houston, We Have an Opportunity”

This is not quite the famous quote from the movie Apollo 13, one of my favorite movies. And, well we have a problem. But also an opportunity.  I’ll get to the opportunity in a bit, but first, the problem.

My Event and Disappointment

The problem of course is COVID-19. As the end of the week in which I’m writing this, I was scheduled to help host the National Weeklong Cave Rescue training seminar for the NCRC. For years, I and others had been working on the planning of this event. It’s our seminal event and can attract 100 or more people from across the country and occasionally from other countries. Every year we have it in a different state in order to allow our students to train in different cave environments across the country (New York caves are different from Georgia caves which are different from Oregon caves and more) as well as to make it easier for attendees to attend a more local event.

Traditionally, the events held in NY (This would have been the fourth National Seminar) have attracted fewer people than our events in Alabama which is famous for its caves. But this year was different, with lots of marketing and finding a great base camp, we were on track for not only for the largest seminar yet in New York, but for one on par with our largest seminars anywhere.

Then, in February I started to get nervous. I had been following the news and seeing that unlike previous outbreaks of various flus and other diseases, COVID-19 looked like it would be something different. This wasn’t going to pass quite as quickly. This was going to have an impact. As a result, I started to make contingency plans with the rest of my planning staff. I consulted with our Medical Coordinator. I talked to the camp. By March I started to regain some optimism, but I still wasn’t 100% confident we could pull this off. And then, the questions from attendees started to come in. “Are we still having it?” “What are the plans?” etc.  Another week or two later, “I need to cancel. My agency/school/etc won’t cover the cost this year.”  Finally by the start of April, after talking to several of my planning staff and my fellow regional coordinators it became obvious, we could not, in good conscience host a seminar in June. Yes, here in upstate New York the incidence of COVID-19 is dropping quickly. We’re starting the re-opening process. Honestly, if folks came here, I would NOT be worried about them getting infected from a local source.

However, we would have nearly 100 people coming from across the country, including states where the infection rates are climbing. Many would be crammed into planes for hours, or making transfers at airports with other travelers. So, while locally we might be safe; if we held this event, where folks are in classrooms for 3-4 hours a day, then in cars to/from cave and cliff sites and then often in caves for hours, it’s likely we would have become ground zero for a spike in infections. That would not have been a wise nor ethical thing to do. So, we postponed until next year.

I mention all that because of what happened to me about three weeks ago and then the news from last week: 2020 PASS Summit is going Virtual. About three weeks ago I was asked to participate in a meeting with some of the folks who help to run PASS as well as other User Group leaders. The goal was to discuss how to make a Virtual Summit a great experience if it went virtual. This was one of several such meetings and I know a lot of ideas we brought up and discussed. NONE of us were looking forward to PASS 2020 being virtual, but we all agreed that it was better than nothing. And of course, as you’re well aware, last week PASS made the decision, I suspect due in large part for the very same reasons we postponed our cave rescue training event.

Sadness and Disappointment

Mostly I’ve heard, if not happy feedback, at least resigned feedback. People have accepted the reality that PASS will be virtual. I wrote above about my experience with having to postpone our cave rescue training (because it’s so hand’s on, it’s impossible to host it virtually). It was not an easy decision. I’ll admit I was frustrated, hurt, disappointed and more. I and others had put in a LOT of hard work only to have it all delayed. I know the organizers of Summit must be feeling the same way. And I know many of us attendees must feel the same. Sure, Houston is not Seattle and I’ve come to have a particular fondness for Seattle, in part because of an opportunity to see friends there, but I was looking forward to going to Houston this year (as was my wife) and checking out a new city.

One thing that has helped buoy my emotions in regards to our weeklong cave rescue class is that over 1/2 the attendees said, “roll my registration over to next year. I’m still planning on coming!” That was refreshing and unexpected. Honestly, I was hoping for maybe 1/4 of them at best to say so. This gave me hope and the warm fuzzies.

Opportunity

Let me start with stating the obvious: a virtual event will NOT be the same as in-person event. There will most definitely be things missing. Even with attempts that PASS will be making to try to recreate the so-called “Hallway track” of impromptu discussions and hosting other virtual events to mimic the real thing, it won’t be the same. You won’t get to check out the Redgate Booth in person, hang out on the sofa at Minionware, or get your free massage courtesy of VMWare.

20191106_123733

After a great massage courtesy VMWare.

And we’ll miss out on:

20191105_143514

Achievement unlocked: PASS Summit 2019 Selfie with Angela Tidwell!

But, we’ll still have a LOT of great training and vendors will have virtual rooms and more.

So what’s the opportunity? Accessibility!

Here’s the thing, I LOVE PASS Summit. I think it’s a great training and learning opportunity. But let’s face it. It can get expensive, especially when you figure in travel costs, hotel costs and food costs. This year though, most of those costs disappear. This means that when you go to your boss, they have even less of an excuse to say, “sorry it’s not in the budget”.  And honestly, if they DO say that, I would seriously suggest that you consider paying for it out of your own budget. Yes, I realize money might be tight, but after all the wonderful training you can then update your resume and start submitting it to companies that actually invest in training their employees.

I would also add, from my understanding, while convention centers by law ADA accessible, this doesn’t necessarily mean everyone with a disability can attend. There can be non-physical barriers that interfere. Hosting virtually gives more people the ability to “attend” in a way that works for them. It might be in a quiet, darkened room if they’re sensitive to noise and lights. It might be replaying sessions over and over again if they need to hear things in that fashion. It very well could be taking advantage of recorded sessions and the like in ways that I, an able-bodied person isn’t even aware of. So that’s a second way in which it’s accessible.

Now, I know folks are questioning “well if its virtual, why should we pay anything, especially if vendors are still paying a sponsorship fee?” There’s several answers to that and none of them by themselves are complete, but I’ll list some. For one, I haven’t confirmed, but I’m fairly confident that vendors are paying a lot less for sponsorship, because they won’t get the same face to face contact. For another, PASS takes money to run. While we often think of it as a single big weeklong event, there’s planning and effort that goes on throughout the year. This is done by an outside organization that specializes in running organizations like PASS. (Note the PASS Board is still responsible for the decision making that goes on and the direction of PASS as a whole, but day to day operations are generally outsourced. This is far from uncommon. Those costs don’t disappear. There’s other costs that don’t automatically disappear because the event is no longer physical. And of course there are costs that a virtual event has that the physical event doesn’t. Now EVERY single session will be available as a live-stream (as well as recorded for later download) and this requires enough bandwidth and tools to manage them. And it requires people to help coordinate.  Making an event virtual doesn’t automatically make it free to run.

The Future

Now, I know right now I’m on track for hosting the NCRC Weeklong Cave Rescue training event next year at the location we planned on for this year. Our hope of course is that by then COVID-19 will be a manageable problem. But in the meantime, I’ll keep practicing my skills and sharing my knowledge and when and where I can, caving safely. And as always willing to take new folks caving. If you’re interested, just ask!

I don’t know what PASS 2021 Summit will bring or even where it will be. But I know this year we can make the most of the current situation and turn this into an opportunity to turn PASS into something new and more affordable. Yes, it will be different. But we can deal with that. So, register today and let’s have a great PASS 2020 Summit in the meantime!  I look forward to seeing you there. Virtually of course!

How Much We Know

Last night I had the privilege of introducing Grant Fritchey  as our speaker to our local user group. He works for Redgate who was a sponsor. The topic was on 10 Steps Towards Global Data Compliance.  Between that and a discussion I had with several members during the informal food portion of our meeting I was reminded me of something that’s been on my mind for awhile.

As I’ve mentioned in the past, I’ve worked with SQL Server since the 4.21a days. In other words, I’ve worked with SQL Server for a very long time. As a result, I recall when SQL Server was just a database engine. There was a lot to it, but I think it was safe to say that one could justifiably consider themselves an expert in it with a sufficient amount of effort. And as a DBA, our jobs were fairly simple: tune a query here, setup an index update job there, do a restore from backups once in awhile. It wasn’t hard but there was definitely enough to keep a DBA busy.

But, things have changed.  Yes, I still get called upon to tune a query now and then. Perhaps I making sure stats are updated instead of rerunning an index rebuild, and I still get called upon to restore a database now and then. But, now my job includes so much more. Yesterday I was writing a PowerShell script for a client. This script calls an SFTP server, downloads a file, unzips it and then calls a DTSX package to load it into the database.  So now I’m expected to know enough PowerShell to get around. I need to know enough SSIS to write some simple ETL packages. And the reason I was rewriting the PowerShell script was to make it more robust and easier to deploy so that when I build out the DR box for this client, I can more easily drop it in place and maintain it going forward.  Oh, did I mention that we’re looking at setting up an Availability Group using an asynchronous replica in a different data center? And I should mention before we even build that out, I need to consult with the VMWare team to get a couple of quick and dirty VMs setup so I can do some testing.

And that was just Monday.  Today with another client I need to check out the latest build of their application, deploy a new stored procedure, and go over testing it with their main user. Oh, and call another potential client about some possible work with them. And tomorrow, I’ll be putting the finishing touches on another PowerShell article.

So what does this have to do with last night’s meeting on Global Data Compliance? Grant made a point that in a sense Data Compliance (global or otherwise) is a business problem. But guess who will get charged with solving it, or at least portions of it?  Us DBAs.

As I started out saying, years ago it was relatively easy to be an expert in SQL Server. It was basically a single product and the lines tended to be fairly distinct and well drawn between it and other work. Today though, it’s no longer just a database engine. Microsoft correctly calls it a data platform.  Even PASS has gone from being an acronym for Professional Association of SQL Server to simply PASS.

Oh, there are still definitely experts in specific areas of of the Microsoft Data Platform, but I’d say they’re probably more rare now than before.  Many of us are generalists.

I mentioned above too that I’d probably be more likely to update stats than an index these days.  And while I still deal with backups, even just the change to having compression has made that less onerous as I worry less about disk space, network speed and the like. In many ways, the more mundane tasks of SQL Server have become automated or at least simpler and take up less of my time. But that’s not a problem for me, I’m busier than ever.

So, long gone are the days where knowing how to install SQL Server and run a few queries is sufficient. If one wants to work in the data platform, one has to up their game. And personally, I think that’s a good thing. What do you think? How has your job changed over the past decade or more. I’d love to hear your input.

2019 in Review

Last year I did a review of 2018 and then the next day I did a post of plans for 2019. I figured I would take time to look back on 2019 and see how well I did on some of my goals and then perhaps tomorrow set goals for 2020.

One of my first goals always is to make one more revolution around the Sun. I can safely say I successfully achieved that.

But what else? I vowed to blog once a week. I did miss a few this year, but pretty much succeeded on that one. But, perhaps those misses where why I failed to break 2000 page views for 2019. That said, I don’t feel too bad. In 2018, I had one particular post in 2018 that sort of went viral, and that alone really accounts for the higher number in 2018. So if I ignore that outlier, I did as well or better for 2019. That said, I think I’ll set a goal of 2020 page views for 2020. It’s a nice symmetry.

I’ve continued to speak at SQL Saturdays in 2019 and will do so in 2020. Still working on additional topics and may hint at one tomorrow.

But I again failed to get selected to speak at SQL Summit itself. That said, I was proud to again speak at the User Group Leadership meeting this year. My topic was on moving the needle and challenging user group leaders to bring more diversity to their selection of speakers (with a focus on more women, but that shouldn’t be the only focus).  It was mostly well received, but I could tell at least a few folks weren’t comfortable with the topic. I was ok with that.

I set a goal of at least 3  more articles for Redgate’s Simple Talk.  I’m pleased to say I not only succeeded, but exceeded that with 4 articles published. It would have been 5, but time conspired against that. That said, I should have another article coming out next month.

I never did take time to learn more about containers.

I continue to teach cave rescue.

I think I caved more.

I didn’t hike more, alas.

And there were a few personal goals I not only met, but I exceeded. And one or two I failed it.

But, I definitely succeeded at my last goal, having fun. 2019 was a great year in many ways and I spent much of it surrounded with friends and family. For reasons I can’t quite put my finger on, I think I enjoyed SQL Summit this year far more than previous years. It really was like spending time with family.

I’ve been blessed with great friends and family and 2019 just reminded me of that more than ever.  Thank you to everyone who brought positive contributions to my life in 2019. I appreciate it.

 

Kids, get off my lawn!

Change can be hard. But sometimes it’s necessary. And a lot has happened this week.  First, I want to congratulate my fellow #SQLFamily member Cathrine Wihlemsen on one more orbit of the Sun. Apparently, in her honor Microsoft decided to release SQL Server 2019 on her birthday! I’ve been using SQL Server since the 4.21a days. Every version has had new features and required learning something new. As I said recently, it’s easy to fall into the trap of being an old dog and not learning new tricks. This is something we have to avoid. Being trapped in the past can be limiting.

Besides SQL Server 2019 dropping this week, I recently upgraded my phone. I had been using a Windows Phone for about 5 years now. I loved it. Especially when it first came out, it was top of the line and had a bright future. I eagerly downloaded apps and it became part of my life. But alas, we know how well Microsoft did in the Windows Phone market. But I doggedly held on, even as features were deprecated. I couldn’t use the Weather App. The Amtrak App went away. Eventually several features of Cortana stopped work as Microsoft stopped supporting them. Slowly my phone was becoming a brick. I kept debating do I upgrade to one more Windows Phone knowing it’s the end of the line, or what? I kept putting off the decision. After the mapping function failed me on my recent trip to the Hampton Roads User Group Meeting I decided it was time to finally time to replace it with an Android phone. Choosing from the plethora out there was not fun. It was very tempting to go with one of the top of the line models, but spending $1000 or so wasn’t really a fun idea.  I eventually ended up choosing a Samsung A50.

I’m mostly happy with it. Right now I’m struggling with what parts of it are “get off my lawn” because I don’t like change, and what parts are “what the hell is the UI doing now?”  Fortunately, my son has mentioned some of his dislike of certain UI functionalities, so I think not all of it is me simply being an old curmudgeon (are there young ones?) I will say what I’m most happy with is that Microsoft has a number of tools including the Windows Launcher and the Phone Companion, as well as the obvious apps like Outlook and other parts office.

A word about the Phone Companion. This alone has made the upgrade a win. One of the features is that when I’m working at home (I have not yet enabled it on my Surface Pro) is that things like text messages pop-up on my desktop screen. This actually makes life a LOT easier, since I can simply type a reply from a full-size keyboard or copy the numerous soft-tokens I get to log into various client sites without having to pick up my phone. It’s a small detail, but a wonderful one!

The Launcher helps me retain some of the features that I liked about my Windows Phone. Overall, it’s a win.

But the changes in my life aren’t complete. As I mentioned last week I’m at PASS Summit again this week in Seattle. But alas, this is the last year that PASS Summit will be in Seattle. Next year it will be held in Houston. Just as I’ve figured out where the cheapest and most convenient parking for me is, where some decent food places are, and I’m feeling, if not at home in Seattle, at least comfortable, next year is a big change. I won’t be able to stay with my college friends or do our annual Thai pot luck with a bunch of ROC Alumns.

But, I’ll get to explore another city. I’ve been to Houston only once, literally decades ago, to do SQL Server install at Exxon. The server was literally the only Intel computer in a room full of mainframe equipment. I suspect that has changed since then.  That was one of my early experiences installing SQL Server (4.21a for the record).

So, this old dog is still learning and looking forward to new experiences: plus ça change, plus c’est la même chose.

 

Small Victories

Ask most DBAs and they’ll probably tell you they’re not a huge fan of triggers.  They can be useful, but hard to debug.  Events last week reminded me of that. Fortunately a little debugging made a huge difference.

Let me set the scene, but unfortunately since this was work for a client, I can’t really use many screenshots. (or rather to do so would take far too long to sanitize them in the time I allocate to write my weekly blog posts.)

The gist is, my client is working on a process to take data from one system and insert it into their Salesforce system.  To do so, we’re using a 3rd party tool called Pentaho. It’s similar to SSIS in some ways, but based on Java.

Anyway, the process I was debugging was fairly simple. Take account information from the source and upsert it into Salesforce. If the account already existed in Salesforce, great, simply perform an update. If it’s new data, perform an insert.  At the end of the process Pentaho returns a record that contains the original account information and the Salesforce ID.

So far so good. Now, the original author of the system had setup a trigger so when these records are returned it can update the original source account record with the Salesforce ID if it didn’t exist previously. I should note that updating the accounts is just one of many possible transformations the entire process runs.

After working on the Pentaho ETL (extract, transform, load) for a bit and getting it stable, I decided to focus on performance. There appeared to be two main areas of slowness, the upsert to Salesforce and the handling of the returned records. Now, I had no insight into the Salesforce side of things, so I decided to focus on handling the returned records.

The problem of course was that Pentaho was sort of hiding what it was doing. I had to get some insight there. I knew it was doing an Insert into a master table of successful records and then a trigger to update the original account.

Now,  being a 21st Century DBA and taking into account Grant Fritchey’s blog post on Extended Events I had previously setup a Extended Events Session on this database. I had to tweak it a bit, but I got what I wanted in short order.

CREATE EVENT SESSION [Pentaho Trace SalesForceData] ON SERVER
ADD EVENT sqlserver.existing_connection(
    ACTION(sqlserver.session_id)
    WHERE ([sqlserver].[username]=N'TempPentaho')),
ADD EVENT sqlserver.login(SET collect_options_text=(1)
    ACTION(sqlserver.session_id)
    WHERE ([sqlserver].[username]=N'TempPentaho')),
ADD EVENT sqlserver.logout(
    ACTION(sqlserver.session_id)
    WHERE ([sqlserver].[username]=N'TempPentaho')),
ADD EVENT sqlserver.rpc_starting(
    ACTION(sqlserver.session_id)
    WHERE ([package0].[greater_than_uint64]([sqlserver].[database_id],(4)) AND [package0].[equal_boolean]([sqlserver].[is_system],(0)) AND [sqlserver].[username]=N'TempPentaho')),
ADD EVENT sqlserver.sql_batch_completed(
    ACTION(sqlserver.session_id)
    WHERE ([package0].[greater_than_uint64]([sqlserver].[database_id],(4)) AND [package0].[equal_boolean]([sqlserver].[is_system],(0)) AND [sqlserver].[username]=N'TempPentaho')),
ADD EVENT sqlserver.sql_batch_starting(
    ACTION(sqlserver.session_id)
    WHERE ([package0].[greater_than_uint64]([sqlserver].[database_id],(4)) AND [package0].[equal_boolean]([sqlserver].[is_system],(0)) AND [sqlserver].[username]=N'TempPentaho'))
ADD TARGET package0.ring_buffer(SET max_memory=(1024000))
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=ON,STARTUP_STATE=OFF)
GO

It’s not much, but it lets me watch incoming transactions.

I could then fire off the ETL in question and capture some live data. A typical returned result looked like

exec sp_execute 1,N'SourceData',N'GQF',N'Account',N'1962062',N'a6W4O00000064zbUAA','2019-10-11 13:07:22.8270000',N'neALaRggAlD/Y/T4ign0vOA==L',N'Upsert Success'

Now that’s not much, but I knew what the Insert statement looked like so I could build an insert statement wrapped with a begin tran/rollback around it so I could test the insert without actually changing my data.  I then tossed in some set statistics IO ON and enabled Include Actual Execution Plan so I could see what was happening.

“Wait, what’s this? What’s this 300K rows read? And why is it doing a clustered index scan on this table?”  This was a disconcerting. The field I was comparing was the clustered index, it should be a seek!

So I looked more closely at the trigger. There were two changes I ended up making.

       -- Link Accounts
       --MERGE INTO GQF_AccountMaster T
       --USING Inserted S
       --ON (CAST(T.ClientId AS VARCHAR(255)) = S.External_Id__c
       --AND S.Transformation in ('Account'))
       --WHEN MATCHED THEN UPDATE
       --SET T.SFID = S.Id
       --;
       
       if (select transformation from Inserted) ='Account'
       begin
              MERGE INTO GQF_AccountMaster T
              USING Inserted S
              ON T.ClientId  = S.External_Id__c
              WHEN MATCHED THEN UPDATE
              SET T.SFID = S.Id
       end

An astute DBA will notice that CAST in there.  Given the design, the Inserted table field External_Id__C is sort of a catch all for all sorts of various types of IDs and some in fact could be up to 255 characters. However, in the case of an Account it’s a varchar(10).

The original developer probably put the CAST in there since they didn’t want to blow up the Merge statement if it compared a transformation other than an Account. (From what I can tell, T-SQL does not guarantee short-circuit evaluation, if I’m wrong, please let me know and point me to definitive documentation.) However, the minute you cast that, you lose the ability to seek using the index, you have to use a scan.

So I rewrote the commented section into an IF to guarantee we were only dealing with Account transformations and then I stripped out the cast.

Then I reran and watched. My index scan of 300K rows was down to a seek of 3 rows. The trigger now performed in subsecond time. Not bad for an hour or so of work. That and some other improvements meant that now we could handle a few 1000 inserts and updates in the time it was previously taking to do 10 or so.  It’s one of those days where I like to think my client got their money’s worth out of me.

Slight note: Next week I will be at PASS Summit so not sure if/when I’ll be blogging. But follow me on Twitter @stridergdm.

Hampton Roads User Group Recap

I’ve talked about how I think it’s important to be part of the #sqlfamily community and how I enjoy talking and giving back. Last week was another example of this. Much earlier this year (it might have even been at Pass Summit last year) I convinced Monica Rathbun to do a quid pro quo. I’d speak at her user group in Virginia Beach if she’d come to upstate NY to speak at my user group. I’d seen Monica speak and knew she would be a great speaker for my group. Fortunately, despite seeing me speak, she apparently felt I’d be good enough for her group.  Seriously though it was a good deal.

My original plan had been to drive down Wednesday, address her group, stay at an AirBnB on the beach and then spend a few nights in the Washington DC area visiting with some friends.  Unfortunately, less than a week before I was ready to head down, my DC plans fell through. This radically changed my travel plans and I scrambled to make various plans to make the trip a practical one and one that wouldn’t break my budget. One of the unfortunate facts of being as consultant is that I don’t have an employer that can cover travel expenses. On the other hand, I often have a lot more flexibility in when and how I travel.

I ended up taking the train to Wilmington Delaware and getting a rental car from there. This allowed the most flexibility, was second in time to flying, and overall the least stressful. I love taking the train because I can sleep (which I did on the Albany to NYC segment) and get work done (which I did on the NYC-Wilmington segment, working on a future article for Redgate Simple-Talk and reviewing my talk) Unfortunately, due to a missed turn, some slow traffic due to the rain and then the rain in general, rather than showing up at 5:30 like I had hoped, I was in the door at 6:15 or so. This gave me time for a single chicken wing before I launched into my talk.

I had been monitoring the Meet-up page to see how many people were expected and at my last count it was 8. I was comfortable with that. I was hoping for more, but hey, I’ll take what I can get.  Imagine my surprise when I walked in and there were closer to 20 people there. Honestly, a great turnout! But, between running late, the usual hardware issues of getting my laptop and the monitor talking, and not being able to get one last run through of a 10 minute section of my talk, I’ve got to say I was a bit flustered.

I love to teach. But I would be lying if I said I don’t love it when I see or hear a student have what I call that “Aha moment!” This is that moment when you explain or demonstrate something and you can see the look in their eyes or the tone in their voice when something just clicks. It might be a small thing to you, but for them you’ve just rocked their world.

A number of years ago while teaching the Level 2 cave rescue class in Colorado, we were doing an instructor lead evolution. During these, the instructors take the lead and guide the students through the problem. It’s usually the first real new teaching experience of the week-long class, before that it’s mostly review. In this case I had a single student working with me and we were charged with setting up two lines to be used as a safety and for another purpose.  I told her to grab a single rope and a carabiner. She looked at me questioning because she knew we needed to have two lines rigged. I then showed her the tree I had selected and told her to basically double the rope, tie what’s known as a high strength tie-off using the middle of the rope, clip it in with the carabiner and toss both ends down. Then the aha moment, “wow, I’d never thought of that. That’s worth the price of the class right there.” I’ve got to say I was proud. My job was done, 2nd day of teaching. I could take the week off. Of course I didn’t.

This time around, I was talking about the Model Database and how most DBAs completely ignore it and overlook it. I was demonstrating how when you put objects in it or change various options in it (such as from Simple Logging to Full Logging) any new databases will pick up those objects or options (unless you override the options using a script.)  As I was bending over the keyboard to type the next demo I heard it, someone in the middle of the classroom suddenly said, “Woah…” and you could tell their world had just been expanded. That alone made the entire 36 hours (including travel time, sleeping etc) of the trip worth it. I knew someone had learned something. I live for those moments.

Don’t get me wrong, I enjoy getting paid as a consultant, but honestly, I speak on SQL Server topics and teach cave rescue for those aha moments, for knowing that I’ve just expanded someone else’s world a bit.

Oh that, and in this case, the free wings!

ehb5jp6w4ae8-at.jpg

Tasty wings at Hampton Roads SQL Server User Group

Just a reminder, I will be at the 2019 PASS Summit in Seattle and look forward to meeting with anyone who wants. My Twitter handle is @stridergdm and I often hang out with the folks at MinionWare (they’ve got a comfortable couch) and will be attending the Birds of the Feather luncheon (undecided where I’ll be sitting) and the Women in Technology Luncheon.

And I’m hoping for my nest article on PowerShell for Redgate’s Simple-Talk to be submitted before then!

 

The Next Generation

As I’ve mentioned previously, I’m a caver. I mention this when I speak as part of a dad joke, that as a caver, I really do know a certain body part from a hole in the ground. I won’t say it makes me unique, there are literally 1000s of cavers in the US and even more around the world.

Like any group of people, not all cavers are the same. Some love long expeditions where they may spend a week or more underground, mapping new caves and plumbing their depths. Others may go in to study the geology or search for fossils. Some are studying the biosphere within caves. I have a lot of respect for those folks. Me, I like to take beginners caving. I also like to teach cave rescue and to talk about it.

And I think my role in taking new folks caving can be as important as what many of my fellow cavers do. Yes, it means I often go into the same caves over and over again, and that may sound boring, but honestly, it’s generally not. I often get to see the cave again through new eyes.

What brought on this post was the fact that I had the opportunity to take a friend and her twins caving for a second time. The wonder and excitement that their 6 year old eyes brought to the cave was wonderful. Passages I took as boring and mundane they saw as exciting and exhilarating. Their enjoyment was a breath of fresh air.

I’m a member of the National Speleological Society  I support the NSS because it supports cavers. But, I have a nit to pick with some (certainly not all) of my fellow members.

Let me preface by saying that caves can be rare and unique areas. While they can appear to be solid, non-changing areas made of stone, they can be dynamic places and the presence of humans can easily have a dramatic, negative impact.  For example, people hiking a mountain don’t have an impact on it simply by breathing near the mountain (they can certainly have other impacts). But, bringing enough people into a cave can have a dramatic impact on fungal and bacterial growth simply due to the amount of moisture they bring into the cave with them. They can also bring fungi and bacteria into a cave that may not have been there before.

In addition, many once beautiful caves have been destroyed by treasure collectors who have broken off cave formations such as stalactites and stalagmites. Once removed, it can be hundreds of years or more before they’ll reform. Even touching a forming one can alter its formation.

As a result of this, I’ve seen a movement that appears to be growing of both gating caves and of not sharing the location of caves. While cavers have often always been a bit protective of cave locations, the perception, at least to me, is that we’ve become more so. We’re reluctant to share the caving experience because we’re afraid “too many people will come and ruin the cave.” And there’s probably some truth to that.

But, while I certainly favor protecting our caves, I think if we’re too protective, we end up risking losing the next generation of cavers.  And the NSS enrollment numbers suggest this may be happening.

So, I personally prefer to take beginners caving. Many will attempt to go anyway, so I’d rather they learn proper caving techniques and cave conservation.  I encourage others to do the same. Take the time to introduce others to this wonderful activity, and teach them how to do it correctly.  And fortunately for every caver that seems to have the attitude of not wanting to “let” novices into caves, there seem to be two cavers that are willing to take novices caving. So, I remain optimistic.

I’ve thought about this also as I look at the presentations some of my fellow #SQLFamily members and realized I do the same there. Many will have great presentations on complex topics and ideas. They’re great presentations. And I respect them for it and admittedly, I’m sometimes jealous of their knowledge and skills. Myself, I seem to prefer teaching more introductory topics. I think continuing to bring new folks into the world of SQL Server and into SQL Saturday and PASS Summit are important. In fact our speaker this coming Monday is Matt Cushing. He’ll be speaking about Networking 101.

To close, I think in any world, but particularly in the two I inhabit, caving and SQL, it takes all types, those who dive deep into the subject and those who take other paths. I don’t think one path is necessarily better than another. The only ones I have an issue with those are those who take the attitude that novices aren’t welcome. You don’t necessarily have to be the person welcoming novices, but don’t be the one that discourages them either. We need to build the next generation.  And that’s my take away for the week.

Busy Weekend Volunteering

As I mentioned previously, I was on vacation for about 10 days and got back to Albany very early Wednesday morning (or late Tuesday night depending on how one looks at it.) And once back from vacation I had to jump right back into two other events I had previously put on my schedule. This meant I didn’t have much time to catch up on work or sleep. But it was worth it.

A confluence of events meant that I ended up being double booked this past weekend. The first event was some special cave rescue training called a Small Party Assisted Rescue (SPAR) class. This was a 3 day class, Friday through Sunday. However, in addition, students had the chance to show up Thursday night in order to test on their skills before participating.  I was both an instructor for this class as well as the site and course organizer. My second event was SQL Saturday Albany, which I had been selected to speak at. I’m also the User Group coordinator that sponsors this event. This double booking meant that I couldn’t instruct at the SPAR on Saturday. I do want to note that at both events there were a number of other volunteers, and some were doing even more work than I was.

Between these two events, it meant I was getting about 6 hours of sleep a night plus putting in a lot of driving. It was a long, tiring, essentially 3.5 day weekend starting on Thursday. Additionally the jet-lag made it seem even longer.

Why do I mention all this? Because, both events are very important to me and cover two large areas of my life. I’ve previously written about some of my SQL Saturday experiences and SQL Pass experiences.  This is part of my professional life. I feel very strongly about volunteering and speaking at these SQL events. I enjoy running our local Capital Area SQL Server User Group (CASSUG) for the same reason. I’m a better DBA because of the shared experiences of my fellow speakers. I’ve written about this previously here and elsewhere in this blog. I hope I’ve helped others.

WP_20190720_002

Deborah Melkin discusses normalized vs. star schemas.

On the other side, as my slide deck often points out, I’m a caver. More critically I’m the Northeastern Regional Coordinator for the National Cave Rescue Commission. I’ve had the privilege of teaching 100s of people how to perform cave rescue, been a media resource during the 2018 Thai rescue, and have spoken and written on the subject. I am by no means an expert, I’m always learning, as are all my fellow instructors. But, we all are not only willing, but want to spend the time and money and effort to teach others. We are passionate about it.  I don’t mean this lightly. For this particular SPAR, while about 1/2 the instructors lived within 2 hours of the event and it was an easy drive, the rest either drove 5-8 hours, or spent all day flying on standby to get here or to get home. None were reimbursed for any of their expenses and in fact had to pay for linens if they wanted them.  They also had to take 2 days or more days off of work to come to New York.

Next summer, I will be the course coordinator for our 2020 National Weeklong here in New York State. This will bring close to 100 people to New York for a week of 14 hour days of teaching and learning cave rescue techniques. Fortunately, I will have a LOT of help organizing this event. But again, all the instructors and staff are volunteers who will travel at their own expense to be here and help teach.

So I spent my weekend volunteering, because I’m passionate about it. How was your weekend?