An Open Letter To SQLSaturday & User Group Organizers

Dear event organizers;

 While this letter is directed at the SQL Server community the points I present here are valid in other situations.

 

The SQL Community

One of the things that makes SQL Server stand out so much from other products (not just RDBMS) is the level of support and caring that it receives from its user base, frequently known as the SQL Community. There are many levels to this: from folks that read a daily newsletter, to those that help run a professional association dedicated to the product. 

Sitting between those two areas are those that like to give back to the community by writing blog posts, answering peoples questions, and presenting at one of the many events that are run throughout the world. These SQL related events are run at several levels: from small local user groups which may attract 20-30 people, to SQL Saturday events that pull in a few hundred, all the way up to the large conferences where attendees number in the thousands.

 

 Starting Speaking 

Everybody has to start somewhere. The people that speak at the large conferences have perfected their craft at the smaller events. The smaller arenas make for a tighter audience where material can be first presented, then improved over time. As important as the adjustments in the material are the changes in the presenters. They figure out the things that do, and do not, work for them. They learn how to read the crowd, handle questions, push through when problems arise with demos, and pace themselves to give a great and informative session which gives the attending audience great things to walk away with.

Breaking into this speaking arena is as difficult as it is daunting. This is why things like SQL Saturday and local user groups are so great. They allow a fairly safe opportunity for people to get their feet wet. Despite the relatively low visibility a presenter may get from an event like this it is still incredibly scary for them to step up in front of complete strangers that first time.

 

Anna's Story

Anna (not a real person, name randomly generated) has worked with SQL Server for 10 years and knows the ins and outs of optimizing stored procedure performance. She makes the decision that she would like to share some of this knowledge with other people, and so spends a few hours making an outline of a presentation with all the things she wants to put in there. After figuring out the key items she puts together an abstract for her local SQL Saturday event and it gets accepted. After another 40 hours of work Anna has a presentation that she feels will wow the crowd. She shows up Saturday morning and walks into a room. There's a projector in front of her, a screen behind her, and 50 people seated, waiting for her to start. Another 15 people file in, there are no chairs, so they are standing around, leaning against the walls. Anna looks around trying to find a friendly face, but there is nobody she knows there.

 Anna manages to get her laptop connected and is projecting things at the right resolution on the screen behind her. That's never an easy task, especially when people are watching. The clock ticks round and she starts her presentation. As she welcomes everyone to the room and gives a brief outline of what people should expect from her session she sees a couple of people get up and leave. 

 Anna now wonders what she did wrong. What happened that these people left? What did she just say? 

A little rattled, Anna tries to remain on track and gets into her slide deck. She explains the concepts that are up on the screen and a man at the back of the room raises his hand and asks a question. Fortunately it's a quick one and she's able to answer briefly and jump into a demo. The first demo goes well, but the guy is raising his hand again and asking another question. This one is a little more complicated. Anna tries to explain but the guy isn't getting the answer and is starting to get a little impatient with her. Other people are turning to look at him and giving looks, but nobody is saying a word. Isolated, Anna tries to handle it as best she can and return back to the presentation.

 As Anna progresses through her slide deck she can hear the guy at the back mumbling to himself. Then he opens up and instead of asking a question blurts out loudly that she's wrong and he knows it. Anna isn't sure how to respond to this. She tries her best to push on but she is feeling intimidated by this loud individual who seems to want to do nothing more than prove how much smarter he is than her. 

Then there is an issue with one of the demos. A query doesn't behave how it should and Anna is confused as to why. She pushes on, hoping that nobody noticed what happened. Of course the one obnoxious guy is quick to point it out. 

 Exhausted from this Anna wraps up the remaining slides quickly, thanks the room, and shuts down her laptop. People slowly file out, dropping slips of paper containing feedback on a desk as they do so. A couple of people stop by to say thank you for the presentation and ask where they can get copies of the slides and demos. She points them to her website, they thank her and leave. Someone else stops to ask a question, but exhausted she can barely answer.

The next presenter comes wandering in the room getting ready to setup for her session. She asks how it went. Anna just looks at her and shakes her head dejectedly. 

 Anna walks out of the room vowing to never present again. It was a horrible experience that she never wants to repeat. She leaves behind 40 slips of paper that rate her session as a 5 out of 5. She misses the comments that state that this was one of the best sessions that they've seen and how her explanation of parameter sniffing finally made them get it and that they can't wait to take all that they've learned back to the office and explain it to the devs and DBAs so that they can get it too.

The community just lost a great speaker who can reach people on topics and that has a wealth of experience behind her. 

  

To SQLSaturday and User Group Event Organizers

Anna is just a single example of what new speakers run into constantly. I've seen this happen first hand to new presenters. It's not pretty and it's not right. Public speaking is a deep held fear for most people, so standing up in front of an audience is a very scary proposition.

I would like to make a suggestion that, in my opinion, should be implemented at all events. When someone is new (or newer) to speaking given them a "buddy." Pair them up with a more experienced speaker who has done the circuit, is comfortable in front of a room, and knows how to handle a crowd or a question. Give that new speaker a friendly face in the room.

 Does it make a difference? Ask Anna what it would have been like if she had been able to look out and see someone give her a smile and a nod, just letting her know that she was doing a good job. 

How much easier would it have been if Anna had someone to help her get setup on the projector?

What about someone to stand up when and ask if the intense questions could be taken offline so that a more in depth discussion could take place to provide the answers that were being asked for?

How would Anna have felt if someone had asked the gentleman berating her to please stop and raise any big issues after the presentation? Or backed up what Anna had been saying?

 If someone had been there would Anna have been as exhausted when things were done? Would she have quickly skipped over peoples questions? Or would she have been engaged, and thrilled that people wanted to hang out and ask about the things she presented? Would she have walked out of the room deciding to never present again, or would she have eagerly grabbed the feedback papers and gone through them trying to gauge peoples feelings?

The chances are that Anna would have walked out feeling tired, but great about what she did. She would have been talking away with her "buddy" about what worked, what didn't, and asking if they had any idea what happened with that demo that went wrong. They would walk away, tweak the session some, add some things, remove some things, fix that demo and move on to submit and present at another event.

On top of that Anna would have made at least one friend that day. The "buddy" never really goes away. It's someone that they keep in contact with, talk to every once in a while, and bounce new ideas off of. The community grows by one new fully engaged member. 

  

To New Speakers

If you are a first time or reasonably new speaker and are feeling nervous about giving that presentation, speak to the event organizers. Ask them ahead of time if there is someone who might be able to come sit in your session to provide some support.

Should you get no assistance or response from the organizers then try to find someone yourself. For a local user group look to find folks who go regularly and drop them a line, see if you can get together beforehand. For a SQL Saturday ask people in the speaker room; scary though they may seem they are really decent people who would be more than happy to help.

 Don't ever feel like you have to go out there alone. There are always options to get someone on your side.

  

TL:DR

  • Organizers: don't let new speakers go out and present without giving them individual support 
  • Presenters: if the organizer doesn't help you, find someone who can be in the room when you present to give you some support

 

 

SHOWPLAN Permission Denied For A Sysadmin

I came across a curious issue the other day when trying to look at the actual execution plan of a stored procedure that was being developed. Strangely I couldn't get an estimated plan either. All I got was the confusing error:

 

SHOWPLAN permission denied in database 'TestDB'

As a sysadmin on the system in question I was very confused by this and it took a little bit of investigation to find out that the problem was actually being caused by the execution context of the stored procedure. 

Here's a quick repro:

 

First, create a new user and table, then load that table up with a few rows (just for demo purposes)


IF (SELECT name FROM sys.databaseprincipals WHERE name = 'TestUser') IS NULL
  
CREATE USER [TestUser] WITHOUT LOGIN;
GO

IF (SELECT OBJECT
ID('dbo.SomeData', N'T')) IS NULL
BEGIN
   CREATE TABLE
dbo.SomeData
      
(
          
Id INT IDENTITY(1,1) NOT NULL
           ,
NothingNess CHAR(10) DEFAULT ''
          
, CONSTRAINT PK_SomeData PRIMARY KEY(Id)
       )
END
GO

INSERT INTO dbo.SomeData DEFAULT VALUES;
GO 100

Now we'll create a couple of procs to pull data from the table. The first will execute under the context of the calling user, and the other under the context of the user TestUser that was just created.

CREATE PROCEDURE dbo.GetSomeData @Id INT
AS
SELECT
Id, NothingNess
FROM dbo.SomeData
WHERE Id = @Id
GO

CREATE PROCEDURE dbo.GetSomeDataTestUser @Id INT
WITH EXECUTE AS
'TestUser'
AS
SELECT
Id, NothingNess
FROM dbo.SomeData
WHERE Id = @Id
GO

Now we can execute both of these procedures and get results just fine.

 

EXEC dbo.GetSomeData 1;
EXEC dbo.GetSomeDataTestUser 1;

However if we attempt to run while grabbing the actual execution plan, or attempt to grab an estimated plan then the second call dbo.GetSomeDataTestUser will fail with the SHOWPLAN permission denied error.


What happens is that when the stored procedure runs it does so under the context of TestUser, and that user does not have SHOWPLAN permissions in the database. This means that you cannot display an execution plan, not could you gather TIME or IO statistics. 


This didn't make much sense to me at first, just because I was a sysadmin, but after thinking for a while it is actually the correct way to handle things. All the permissions are contained for execution of the code within TestUser. So if TestUser does not have the rights to do something, or access something then the calling user would not be able to get to that information.


As a workaround for this all that needs to happen is to grant the showplan permission to TestUser and everything will be fine. For example:

GRANT SHOWPLAN TO TestUser;

It's worth noting that this permission is database scoped, so don't expect to execute it in one database and have it work everywhere.

Technet has a good write-up about all the things covered by SHOWPLAN, it is worth a read for more information.


TL;DR - If you get SHOWPLAN denied errors check that the context for the user actually execution the query has the requisite permissions, and grant showplan if needed. 

SQL Server 2012 Data Loss Bug

Microsoft have just posted a hotfix for a very serious bug in SQL Server 2012

This bug could potentially cause you to lose data during online index rebuilds.

 

At this time I would not recommend downloading the hotfix (wait for a CU which will address the problem). In the meantime follow the posted workaround which is to perform online index rebuilds with a MAXDOP of 1. For example:

 

ALTER INDEX <idxname> ON <objectname> REBUILD WITH (ONLINE=ON, MAXDOP=1);