Sep 23 2014

SQL Server Query Performance Tuning

The latest update to my book, SQL Server Query Performance Tuning was released last week. This is the fourth edition of the book, and the third edition that I’ve been responsible for. At the urging of my editor, Jonathan Gennick, I have completely restructured the book for this release. The chapters have been broken up and rearranged so that they’re smaller, more easily consumed. Yes, I’ve worked with my technical editor, Joe Sack, to add lots of new information and to ensure that the existing information is more accurate and more useful. But, we’ve also added new chapters on topics that weren’t given enough attention in the previous versions of the book, such as parameter sniffing. It can certainly seem like these book releases are just some incremental changes on top of existing information, but not this time. This is a new book, with a new structure and new material (almost 80 pages worth), but, hopefully, with all the usefulness of the old book fundamentally intact. Please check it out.

If reading books isn’t your thing, or, you just want some personal interaction to assist your learning, I’ll be doing an all day, pre-conference seminar on query tuning at the PASS Summit this year, 2014. Go here to register.

Sep 22 2014

Communication and the Board: #PASSVotes

The whole idea behind PASS is to build a community of people who can assist each other in their daily work lives. PASS succeeds at that wonderfully. Further, PASS, the organization, tries extremely hard to let you know what it’s doing and how it’s doing things. You can read the PASS Blog to get all sorts of good information. One of my recent favorites was this great summary of how the Summit speaker selection process was run. I think it’s a positive thing that the organization is so open. I intend to take it one more step.

If I get elected (huge “if”), I’m going to make a point of blogging about, well, the stuff I end up doing. No, I’m not going to be the official mouth-piece for the organization, and no, I don’t mean I’m going to tell you secrets or spread silly gossip. I mean I’m going to share my thoughts and processes on the stuff that I’m doing within the board so that you know what you got out of me. Casting your vote is an act of trust. I want to do what I can to show I’m worthy of that trust, so this is my plan.

My name is Grant Fritchey. I’m the Scary DBA. I’m running for the PASS Board.

For more information about me, why I’m running, etc., please check here. For more information about the PASS election, please go here.

Sep 19 2014

A Manager or a Community Person: #PASSVotes

I am running for the PASS Board. You can read more about what I’ve posted and what others have to say here on this page.

Today I want to ask you a question. Should someone on the board be a manger or should they be a community person? Let’s avoid the easy answer of both for a moment, not because that’s the wrong answer, but because it’s the right one. Clearly you need a mix of these skills to be on the board. But, where you fall on my simplistic question could determine the kind of person you want to vote for on the board. Let’s discuss it a bit.

According to Wikipedia (deal with it), a board of directors is “meant to oversee the activities of a company or organization.” Well, my question is answered then, a manager is what’s needed. We’re done. Boy that was a stupid question Grant. But hang on a second. Let’s take a look at the mission statement of the PASS organization:

Empower data professionals who leverage Microsoft technologies to connect, share, and learn through networking, knowledge sharing, and peer-based learning.

Now what do you think? Do you just want some manager type, or maybe, just maybe, having a data professional directly involved in peer-based learning, for example, answering questions on SQL Server Central. A person heavily involved with knowledge sharing, maybe, running a blog and presenting webinars.  As for networking, let’s talk at one of the live events where I’ll be presenting technical talks. In short, I think I’m well positioned to answer the PASS mission statement. I have team lead and project lead experience. I’ve also helped run volunteer organizations. But, what I really am is a community guy. My passion and my interests line up directly with the PASS mission statement. This is a large part of why I’m running for the board. I believe in what the organization does and I want to help it do more.

So, I’m pretty sure we need managers, but I really do think we need community people too. If you agree, please consider voting for me, Grant Fritchey, during the PASS Election between the 24th and the 29th of September. Keep on an eye on your inbox for your ballot and your chance to vote. For more information about the PASS election and information on the other candidates, go here.

Sep 17 2014

I Am Running For the PASS Board of Directors: #passvotes

This year, I submitted my application to run for the PASS Board and it was accepted. This then is my announcement to all of you and the beginning of my campaign for election. My name is Grant Fritchey and I’m running for the PASS Board.

It’s traditional to either make all sorts of promises for the things you’re going to do or to attack your opponents. I’m not going to do either. I don’t have any grand promises to make. I’m not going to attack my opponents because I know and respect them. I’m voting for James Rowland-Jones myself and so should you. Let’s do this instead. Let’s talk about PASS, you, me, your career, mine, and how PASS can change your life.

PASS changed my life for the better. Like many people, I’m constantly trying to learn how to do my job better. In 2005, I got the opportunity to go to the PASS Summit in Dallas. Just like many of you, I attended sessions and learned all sorts of things. It was great. Right there, PASS can change your life by teaching you more about SQL Server and related technologies. Not life changing enough? Not for me either. While there, I met some volunteers who were helping to run the organization, so I decided to volunteer too. One thing led to another and suddenly, I knew people from all over the country and our “family reunion” was at the PASS Summit. Yeah, a network. No, not to look for a new job. That’s not the primary reason for having a network. The primary reason for having a network is an extended set of knowledge. I know some things my friends don’t. They know some things I don’t. We can help each other. PASS supplies the medium through Summit, SQL Saturdays, the BA Conference, webinars and the local user groups it supports to provide you with the means to build your own network. That’s pretty life changing, right? Yeah, I’m somewhat underwhelmed too. I also started speaking at the local user group that we set up and I started submitting to speak at PASS and finally made the big stage. Oh boy, I get attention. Yeah, that’s one reason for doing it, but, at work I started presenting a lot more too. I was presenting stuff to my team, my boss, their boss, and ultimately to large sections of the organization. Yeah, PASS can help you there too, again through SQL Saturdays, your user group, and maybe, for a few, Summit. There are also opportunities for you to write, record videos, help run the program committee, all sorts of volunteer positions within the organization that will assist you in building your skill set and your presence which will all be completely applicable inside and outside work. I’ve done many of these and they lead me to becoming an MVP and getting a fantastic job for an amazing company. I absolutely attribute all that to PASS. PASS changed my life, and it can change yours.

So, back to this election business. Why am I running for the board? Because I want to do two things. First, I want to help keep the organization going strong and I think it’s time that I volunteered at a higher level to make this happen. Second, I want you to find and take advantage of the opportunities that PASS offers so that it can change your life too. We need to get the word out to a lot more people in order to show them what the organization can do for them. It’s about teaching technology, sure, but it’s also about networking and mentoring and personal growth. This organization can, and will, change your life. The structures are there. You just have to make the choice to reach out and grab those opportunities. I want to share this with others. Those are my reasons for running.

The only promise I’ll make is that if I get on the board, then the passion I bring to, well, everything, will be applied to whatever work I can do there to keep this organization running and get you the opportunities to change your life. Please vote for me. My name is Grant Fritchey and I’m running for the PASS Board.

For more information about the election, to see if you are eligible to vote, to see the other candidates and all the rest of the details, go here.

Sep 16 2014

PASS Summit 2014 Pre-Conference Seminar

I’m putting on a pre-conference seminar (also known as a pre-con) at the PASS Summit this year. I’m really honored to be able to present this and I’m pretty excited about it. So, if you want to talk query tuning, let’s get together at the Summit. For a few fun facts about the event, check out this Q&A over at PASS. To register for the event and my pre-con, go here now.

Sep 15 2014

Podcast on Devops and the Database

I’ve been attempting to expand my reach to get back to my roots in development. I’m doing this because I really believe in the concepts behind devops, that these walls we’ve erected between development and dba, between dba and san admin, et, ad nauseum, cetera, need to come to an end. The great news is that there are a lot of other people who feel the same. We’re changing things. Come on over to the dark side, we have wine. Any way, I had a blast talking database devops with Bryan for his podcast. Have a listen and let me know what you think.

Sep 10 2014

Statistics in SQL Server

I’ve put together a new Curah! of links to some of the better articles on SQL Server Statistics, specifically those for SQL Server 2014. The changes in the cardinality estimator can’t be ignored. If you want to talk about statistics, I’ll be presenting at Live360 in November on that topic and several others. Go here to register for this event.

Sep 09 2014

It’s All Fundamentals

I’m learning how to speak German. Interestingly enough, you don’t start off reading dissertations. Instead, you begin by learning the names of things, Teller for plate, Buch for book. The fundamentals. I’m a third degree black belt in Ken Ryu Kenpo. But you don’t start that, or continue it, by learning complex kata. Instead, you start with how to make a fist, how to hold your hands up in a defensive stance. The fundamentals. I’ve been doing crossfit and Olympic weightlifting for a couple of years now. I’ve been working hard on my clean, standing up tall during the lift, getting my elbows around quick. The fundamentals. Situation after situation, skill set after skill set, you have to get the fundamentals right. And, if you don’t get the fundamentals right, you’re going to find progression extremely difficult.

Which brings us to IT. Let me pick on developers for a moment. You know that ORM tool you want to use? It’s actually a pretty amazing piece of software. Too bad you glossed by all the documentation on how to use it properly, skipped the reams of best practice documentation, and simply took the “Hello World” example to deploy it to production. Because now, that great piece of software is creating serious pain for the company. You skipped the fundamentals. Data pro’s, seriously, you’re asking how to turn off transactions in SQL Server because maintaining the transaction log appropriately is too hard? You have completely skipped the fundamentals. You’re of the opinion that foreign keys are a major performance bottleneck? Fundamentals. You think you can do a scale-out ID/Value data collection scheme in a relational database? Fundamentals.

But none of that is the issue. You want to know what the issue is? PowerPoint templates. Oh my Freya’s Girdle is on fire flipping gods in Valhalla, do you have any idea what a pain in the bottom it is when you have 100+ slides, in a single presentation, that you have to convert to a new template for ConferenceX and the template was constructed wrong? Your fonts go insane, colors dance across the screen like the Bifrost Bridge on an acid trip. And then, when you attempt to fix things by reapplying the template, you find out that oh, noes, we didn’t use the background, we just pasted our graphics on the screen (which takes up 1/2 the real estate forcing your fonts to be so tiny that Buck Woody can’t hear you) so now you’ve got to carefully navigate around extra stinking graphics everywhere, oh, AND, your presentation is now 19 times the size it was before, so your machine is running out of memory to run your demos before you even get the VM started. And then you have to touch each and every slide and adjust them, one at a time. Aren’t we data pros all about set-based processing?

Fundamentals.

Please, if you’re responsible for a conference, whether you’re running a SQL Saturday event, or you’re the chair for a track at the largest of international venues, do all your speakers a favor. Please, take a set of slides from online somewhere and try to get them to work with your template. If you can’t (assuming those slides aren’t already a hack because of ConferenceY down the street who is even worse than you are), work with your artists or whoever put the templates together to get those templates to work well. Otherwise, you might as well just come out and say that you hate speakers and you’re getting a mighty giggle from the work they’re going to have to do to try to make your hag-ridden nightmare of a template work with the beautiful slides they spent weeks putting together.

Thank you!

Sep 05 2014

Speaker of the Month: September 2014

This month I’m very grateful because I was given the opportunity to present at DevLink in Chattanooga. I got to meet a lot of new people and see presentations by people that just don’t hang around SQL Server specific events. It was great. I’m going to apply next year (depending on scheduling of course) and I’m applying for a lot more development conferences. I still get to see friends present, Louis Davidson, Kevin Boles and Kevin Kline were all there. But I get to see new people. Speaking of which, speaker of the month for September 2014 is Josh Lane (b|t) and his presentation AWS vs. Azure, Which One Is Right for You.

The thing that I found the most amazing about this presentation was how even-handed it was. Josh Lane really went out of his way to find positive (and negative) things to say about both platforms. Because of this, I think anyone really trying to understand which platform to pick, and, more importantly, why they should pick it, walked away with good data. I’m working with Azure regularly and I picked up a few things that I didn’t know. I also liked how he identified lots of commonality between the two platforms. The slides were very simple and clean and well structured. Mr. Lane’s delivery was excellent. He was engaging, handled questions well, and kept things moving. I was really impressed.

The one issue I have with the presentation is that there was really way too much material. He didn’t just rush through the last of it. He skipped right by sections. And those sections looked interesting. I’m pretty sure this was put together for a venue that had more than an hour of time, but I don’t think he would have made it through on a 75 minute schedule either. So, as much as I hate to say it, I’d suggest trimming some material. Going quickly through some doesn’t usually make people too angry, but skipping stuff entirely makes them feel ripped off. But, what a great problem to have. Too much awesome, well delivered material.

Thanks for the session Mr. Lane. I’ll keep an eye out for other material from you in the future.

Sep 03 2014

Left or Right?

No, this is not about politics. It’s about your WHERE clause… and your JOIN criteria… and your HAVING clause. It’s about a canard that still makes the rounds occasionally. Please, help me put this statement to sleep for once and all:

A function on the left side of the equals sign can lead to performance problems

Well, you know, it’s sort of true. But then, a function on the right side of the equals sign can also lead to performance problems. In short, it’s not the placement of the function that causes issues, it’s the function that causes issues. Let’s take a look at a really simple example:

SELECT  a.AddressID,
        a.AddressLine1,
        AddressLine2
FROM    Person.Address AS a
WHERE   a.AddressLine1 = 'Downshire Way';

This simple query results in an equally simple execution plan:

ExecSimple

Now, if we decide that we want to do something like look for all results that have ‘Way’ in them. It’s a different result set, but our index could be used for the new result set. The query will get modified to this:

SELECT  a.AddressID,
        a.AddressLine1,
        AddressLine2
FROM    Person.Address AS a
WHERE   RIGHT(a.AddressLine1, 3) = 'Way';

That’s a function on the left side of the equals sign. OMG!!1! The execution plan isn’t as nice any more:

ExecScan

So, if we change the query to this:

SELECT  a.AddressID,
        a.AddressLine1,
        AddressLine2
FROM    Person.Address AS a
WHERE   'Way' = RIGHT(a.AddressLine1, 3);

Whew, dodged a bullet since we have the function on the right side of the equals sign. And so we get a better execution plan now:

ExecScan

Uhm, wait. That’s still a bad plan isn’t it? Why yes, yes it is. That’s because the problem isn’t which side of the equals sign we have a function, but the fact that we have a function on the column at all. There are a number of permutations we can get into around this. For example, what if, instead of putting the function on the column, we put it on the string, to only match to ‘Way’ instead of ‘Downshire Way.’ Well, that would fix the function issue, but then, we’d have to use a LIKE command and add a wild card to the beginning of the string, resulting in scans again. But the fundamental concern remains, we’re not talking about the left or right of the comparison operator, we’re talking about the existence of the function on the column.

Please, don’t repeat this one any more. OK? Thanks.


 

For lots more on query tuning, let’s get together and talk. I have an all day seminar in two weeks at Connections in Las Vegas. Please go here to sign up.

Or, I’ll be doing a full day pre-conference seminar at the PASS Summit this year in Seattle. Last time I gave a similar talk it sold out, so please, if you’re interested, sign up now.