Dec 05 2011

Resolutions: Outcome

Earlier this year, I wrote a post about my upcoming plans for the year in response to a question asked by Jen McCown (flat out, one of my favorite people, blog|twitter). It was supposed to be about resolutions, but I just don’t make those. I make plans.

Here we are, close to a year later (11 months). How did the plans work out?

The first one, hinted at the time, was to start a new job. Well, that’s done and it’s going swimmingly, thank you very much. The job has turned out to be harder than I thought it was going to be. I travel more than I thought I was going to travel (although we’re keeping it within the limits we agreed to, I love my new company). Frankly, I’m concerned that I’m doing a good enough job, pretty much all the time. But, I love it. Thank you, everyone at Red Gate Software.

Next one was setting up the home office. I’ve got that done too. It proved to be quite difficult, but with lots of help from Glen Berry (blog|twitter) and several other people on Twitter and elsewhere, I finally have a functional set of systems. Currently I have three computers, my glorious Lenovo W510 laptop (sporting lots and lots of flair), a POS Dell desktop (which, as soon as it crashes & burns again, I’m replacing), and a nifty little HP Proliant MicroServer that I’ve named Bob. I even have a little Iomega raid array. I’ve learned how to set up AD and have these things humming along well enough. I’m able to set up tests and get done what I need to get done for my job. I won’t lie. It’s been a pain in the bottom having to set it all up myself. I’m still spoiled from working at a large corporation where I didn’t have to sweat this stuff, but I’ve managed to get done what was needed. I learned how to set up virtuals and I’ve been using a couple of them for most of the last year while working with SQL Server 2012. Trivial stuff for a lot of you, but a leap forward for me.

Then I promised to drill down on a new set of tools. Once again, referring to my glorious job at Red Gate. Man, I had no idea those guys worked so hard. They are releasing new software and new functionality constantly. I can’t keep up. I love it. I rate this goal only about 1/2 accomplished and I think I could have done a somewhat better job at it. I’m going to try to improve on this in the coming year.

The last one, writing more… Unfortunately, I accomplished this one all too well. I did rewrite the execution plans book , but we’re looking at rewriting it again (some structural needs and to capture 2012 stuff). I’m close to half way through rewriting my performance tuning book . That one slowed down because I took on another project, SQL Server in a Month of Lunches, which I’m also about 1/2 way through. Oops. If you’re counting at home, that’s three books this year. Not good. Oh, and did I mention I wrote a chapter for the MVP Deep Dives II? And, I’m maintaining my chapters in Beginning SQL Server Administration (2 of 3 done as I write this). Yeah, five (5) books this year… no, no, no. Stop. That’s on top of all the new articles for my most excellent job, maintaining this blog, starting another blog… Yeah, writing successful. Don’t do it again.

On the whole, I’d say I accomplished what I set out to accomplish on 3 of the 4 goals. The incomplete one, getting better with Red Gate tools, is going to be ongoing anyway, but I still need to improve.

Oh, and by the way, thanks for reading this blog over the last year.

Sep 30 2011

SQL In The City: LA

Just a reminder that there are a few seats left for SQL In The City: LA on the 28th of October. It’s a free event put on by Red Gate Software. I’ll be speaking there. But much better than that, you can listen to, and interact with, Steve Jones, Brad McGehee, Ike Ellis, Aaron Nelson, and ta-da, Denny Cherry, and double-super ta-da, Kalen Delaney (line forms behind me to talk to Kalen), plus the developers and program managers from Red Gate software that will be there.

Take a Friday off work and go get your learn-on. Show your boss the agenda. I guarantee they’ll let you go. Click here to register.

You know what else? If you pick up a copy of MVP Deep Dives II before the event, I’ll bet you it won’t take much cajoling to get autographs from some of the authors and editors.

Let me list it out: Red Gate, MVPs, Free Training, Great Networking, Books, Cool Software, Red Gate Pale Ale…

See you there!

Sep 26 2011

Book Review: Smarter, Faster, Cheaper

In my continuing quest to not get personal visits from Buck Woody (blog|twitter) I’m making sure that I make good on my commitment to read 12 personal development books in 12 months. We’re up to #4 (again demonstrating the degree of fear that Buck can put in a person) and the book is Smarter, Faster, Cheaper: Non-Boring, Fluff-Free Strategies for Marketing and Promoting Your Business by David Siteman Garland (blog|twitter).

The extended title on the book covers what it’s about quite well. David Garland is considered one of the top marketers these days and he seems to follow the processes laid out in his book. I say this because I received a tweet from him after I tweeted that I’d finished reading the book. One of the processes laid out is to set up search routines to keep an eye out for your name, your companies name, your book’s name, and go to where those things are being posted and respond, in person.

I can sum up a huge part of the book in those last two words, in person. He’s very much about the concept that what you’re selling is not a widget, but yourself and that the more and better you sell yourself, the more and better your widgets will sell. The focus of the book is on marketing and selling, which is good, that’s what I expected and wanted. I’m just still having trouble wrapping my brain around the fact that I’m in sales & marketing. But, the good news, for me anyway, is that David Garland’s idea of sales is to generate useful content. Wait, what was that? You mean writing books, blog posts, articles, recording videos and presenting online & at user groups is sales & marketing? Sweet! I’m in favor.

The point is, you have to move away from the ideas of marketing the old way, buying commercial time on TV and move into using the intertubes to do your marketing. That marketing is done by becoming a trusted advisor, or as Seth Godin has it, a linchpin. You do that by generating material, like this blog, and handing it out for free. You take part in discussions in forums, twitter, whatever, and grow yourself into a trusted resource THEN, you carefully sell. I’m sold. Of course, I’ve been sold. I got this message a year ago, right before I changed my career path. The book goes on to discuss various mechanisms of engagement and production you can use to build up that material which will turn you into a trusted resource. There’s a lot of great advice about how to manage your online presence, how to overcome fear (of failure, success, what have you), produce video, and probably most importantly, building a community. The book is all about building out a community of people that you help and who in turn help you. A real community, not just a bunch of readers or viewers, but an interactive group of individuals. Again, I’m in favor.

Unusual enough for a modern book, he has an Index. In fact, he has a good index. When I saw that I had to check to see if I was reading one of my history books or a technical book. No one puts indexes in books any more (apart from historians & geeks). Excellent.

So that’s what the book is all about, how did it affect me, personally? I have to say, I’m a bit… meh, about it. Don’t get me wrong. It’s a very well written book and I believe in what David Garland is pushing here. I think he’s 100% correct and I think the book would be very useful to others. Unfortunately, I’ve read several of Seth Godin’s books and I’ve been pursuing this line of approach already, so… while the book reinforced the things I know, the approach I’m taken, the beliefs I’m working under, it didn’t add a lot to them. But I think the fault here is the reader, not the book. However, I still found it useful, if for nothing else the reinforcement that I’m at least striving in the right direction (which is very nice to have).

I did find the chapter on reputation, “Your Reputation in the Transparent World We Live In” … scary and useful. I’m sure that doesn’t sound good, but it is. I’ve made several adjustments to how and what I do online over the last year and I suspect I’ll be making a few more changes based on this. I’m just nervous about going too far and becoming boring (right, right… more boring).

Anyway, on to the next book, Free Agent Nation: The Future of Working for Yourself by Daniel H. Pink.

Aug 11 2011

Google + Hangouts

I just finished hosting my third hangout on Google Plus. I’ve also attended one hosted by Andy Leonard (blog|twitter) and one hosted by Tom LaRock (blog|twitter). I am blown away by how useful these things are. I’m actually struggling to try to put it into words. This may be something of a ramble.

Jorge Segarra (blog|twitter) brought it up during the conversation this morning, you can’t know everything. You can’t. So what do you do when you’re hitting an issue that you can’t solve because you just don’t have the knowledge? Well, you contact someone who does have that knowledge. You work your contacts and your network and track down the information, because someone you know either knows that bit of information or they know someone else who does. That’s a huge part of what the SQL Server Community (capital “C” on purpose) is all about.

Now, there’s this Community out there. People are tweeting, blogging, publishing articles, publishing books, posting on Facebook, G+, LinkedIn. There are online seminars, free or paid, that you can hook into and get presentations by amazingly smart, talented, skilled people. There are good old fashioned discussion forums and fancy new question & answer forums. But, with all that, the conversation isn’t really a conversation. And the connection is still through a keyboard, not your eyeballs & ears. If you attend a SQL Saturday or the PASS Summit or Connections or SQLBits, you can make that direct, in-person, watching someone’s face contact. But, let’s face, it’s hard to get to too many SQL Saturday events if you have a life (and I’m paid to go to SQL Saturday events as part of my job). Plus, once you’re there, things get really busy and you don’t get the chance to sit down & chat with people all the time, or certainly you don’t get a chance to chat with as many people as you’d like.

That’s where Google Plus Hangouts come in. Now, you’re sitting at home, but you’re also sitting on Andy’s deck and in the offices at PragmaticWorks with Jorge. You’re having a conversation (or listening, seemed like more people lurked than talked, still) with these people. They’re sharing stuff that comes to mind. You’re getting Jorge’s thoughts on appliances (assuming there are no blue badges around) and you get to hear how Brent Ozar’s (blog|twitter) new consulting business is going. And you get to see their faces and hear their voices and it’s all incredibly powerful because it’s interactive. It’s level. It’s not a teacher with a captive audience like an online seminar. It’s completely open.

I’ve been reading a book called Tribes: We Need You to Lead Us by Seth Godin (blog|twitter) as part of my 12-Book commitment. In it he talks about how businesses and individuals, more and more, need to build up a tribe around them. Interested, dedicated, excited people, who care about the cause, the business, the technology, the whatever, who want, actively want, to be there. Google Plus Hangouts. You have to try to get there. You have to want to stay. And, most importantly, you, by going, by staying, get to drive the direction of the tribe. You get to make your voice heard or get the information you need because it’s your tribe too, not just the person hosting it.

Tom’s hangout was very specific with an agreed upon agenda and purpose, like a study group. And it worked, because it was exactly like a study group. People who knew stuff shared with those who didn’t and you were able to ask questions. It’s just amazing how powerful it felt. So far, my hangouts have just been free-flowing affairs, all about the conversation, but I can see how you can make them targeted from what Tom has done. And it’ll work and be powerful, because it’ll still be a conversation.

I came out of the hangout today with a series of web sites to look at, a white paper to read, and a new book for my reading list. By taking part in this thing, I’ve got more tools to make myself better at what I do and I’ve engaged more tightly with my tribe. This will help me as a person and as a representative Red Gate. And, hopefully, I’ve helped others by opening up the tribe so that anyone can join.

I’d like to see a few changes to Hangouts. First, we should be able to record them and post them. Second, 10 is just a bit too small. I’d rather see it go to 15. But no more than that because too many and the conversation will stop. Sharing a desktop would be good too.

But I’m going to do more of these things. I’ve already set up a special circle on Google Plus that’s only people who are members of the Friends of Red Gate. I’m going to have targeted sessions with them and conversations, to try to improve that tribe. I’m also going to try out some other stuff for other tribes. I’m going to host them at various times of the day so that people in different time zones can take part. Today, I covered the planet. I had people from Australia, the UK and all over the US. I’m sure I can do more.

If you’re thinking about trying to make a bigger splash, host one of these. Tweet about it. Post it on Facebook, heck, let me know, and I’ll post it on G+ or Twitter. I also would be interested in what you think about these things. Excited, bored? Interested or not. I feel like we’ve got a new tool but I’m still not 100% sure how it works or the impact it’s going to have.

Apr 15 2011

SQL Azure

cloudIf you’ve talked to anyone from Microsoft recently you had to have heard the phrase “all in.” It’s been made very clear. Microsoft is all in on the cloud. What’s that mean? My understanding of it means they are really, seriously committed to building a viable and large presence there. Part of that presence is SQL Azure.

Say the word “cloud” and watch DBAs flinch, wince or moan, sometimes all three at once. I have been one of them. I looked at the list of restrictions on a cloud database, snickered, and moved on. But you know what? They’re wrong and I was too. The cloud is absolutely coming. Microsoft is not alone in believing this. Look at the offerings from Google and Amazon and others. It really is becoming a part of the landscape, no arguments.

So here’s the question. What are you doing to learn it? How are you diving into Azure? How much of that precious learning and testing time that you carve out for yourself (and if you don’t, you should, no one is going to just give it to you) are you committing to the cloud? Unless you’re one of a few people I know, I’d be willing to bet you, it’s not enough. You need to do more. So do I.

This is my announcement. You’re going to start seeing Azure stuff here. No, I’m not going “all in” on the cloud. You’ll still see stuff on exec plans, performance tuning, backups, community, monitoring, whatever it is I blog about usually. I am going to learn SQL Azure though. I am going to have it as a properly sharpened, oiled and well-maintained tool in my toolbox. Why? That one is easy. Because Microsoft is “all in.” Pick any name you want to call me, and I won’t argue with you, but the fact is, I’ve basically made a living off Microsoft for more than 20 years and I figure I’ll continue as long as there’s a living to be made. I’ve already made the point that I am absolutely not that person that has a single year of experience repeated 20-50 times. Are you?

Want to get started? Buck Woody (blog|twitter) has put together a pretty useful set of links that can get you going with minimal pain. After that, it’s up to you. Watch this space and my other blog (the glorious company I work for is also pursuing business in SQL Azure) for more posts on this topic.

Jan 14 2011

Failed Blog Posts

garbageOver the last week I’ve started and trashed two blog posts. Let me tell you, that’s painful. You get some great idea and then it all goes south. For example, I was going to explain the difference between a table/heap scan and a clustered index scan. The problem was, I ran into gaps in my knowledge, some outright errors in my beliefs on how data was stored, and really faulty conclusions drawn from those facts and a less than thorough set of tests. I’m not even going to tell you what went wrong with the other notion. Luckily, all this was behind the scenes so I didn’t post my ignorance for all to see.  Since I’m not offering you a chance to point & laugh (in this instance), you might be wondering why you’re here.

I’m using my failures to come up with a good technical blog post as a teaching moment. Or, to put it another way, I need to get a blog post put together, so describing why I don’t have one might be a way to do that. Or, to put it another way, I’ve got a stack of lemons, might as well try my hand at lemonade (although, is there a way to ferment lemons? hmmm, more research on this needed, note to self). The point I want to make? Blogging, even when you mess it up and put together bad information, is a great way to learn.

It’s entirely possible to simply slap together a blog post and put it up. No lie. You can do that. I’m fairly certain some bloggers do. I could do that. Better still, you could go and copy Books Online or some other blogger. But, if you are trying, as I am trying, to actually have a blog that’s useful, more is needed. So you think up an idea, what is the difference between a clustered index scan and a heap scan. Then you start writing down what you know. For example, heaps aren’t stored the same way as clustered indexes. Heaps only have pointers back to the Index Allocation Map, where as clusters are stored with a doubly linked list of pages. Then you start thinking up ways that this is proof of something. Good, bad, indifferent, you have to tell a story about the information. That’s where things went south for me. I’m not going to go into details on all my mistakes. Suffice to say, mistakes were made.

The point is, while I messed things up, in my effort to get it right, I had to run tests. I had to read up on data storage mechanisms. I did searches on the internet to see what people I trust said about this stuff. In short, I learned a lot. And yeah, I started from a bad point and made a number of mistakes, but my efforts to ensure that what I was putting out wasn’t complete garbage resulted in more knowledge, if fewer blog posts.

This is one of the best things about blogging. If you’ve ever considered starting, I would encourage you to try it out.. I get three things out it. First, I learn. I have to learn to put these posts up. I try hard to make sure I’m not putting up utter garbage. I may make small errors, but large ones are hopefully not here. Second, I get a chance to organize my thoughts. Writing down how something works, or at least your understanding of how something works, is extremely helpful in furthering that understanding. This is especially true when you’re attempting to share with others, to teach. Nothing so much improves mastery of a skill as teaching that skill. Finally, I get a great set of documentation. When someone asks me a question on something I’ve blogged about, I can point them to my blog. When I need to remember something that I’ve done before, I’ve got documentation I can use. Blogging is an excellent tool for the knowledge worker. And, of course, an added benefit, if you get something right, you can share with others.

That’s it for lemonade. If you’re looking for more information on heaps, go read Kalen Delaney’s (blog|twitter) Internals book, Paul Randal’s (blog|twitter) blog, Kimberly Tripp’s (blog|twitter) blog, or Tibor Karaszi’s (blog|twitter) excellent blog, especially this post on heaps and inserts. In the mean time, I’m going back to the drawing board, trying new things in order to come up with some more posts to keep this place hopping. If you want to try to move towards mastery yourself, start blogging.

Of course, the real problem with this post is, this is the only one like it I get.

Jul 06 2010

Small PowerShell Script

I’m still trying to learn PowerShell better. The opportunity to answer simple questions and problems with the tool is hard to pass up. We had a need to clean up data directories where data files were left behind or people put inappropiate files, so I wrote the following Powershell script:

param([string]$filelocation="",[string]$sqlinstance="(local)")

Set-Location $filelocation

foreach($file in get-childitem)

{$base = $file.Name;

$result = Invoke-Sqlcmd -ServerInstance $sqlinstance -Query "SELECT DB_NAME(mf.database_id) AS db FROM sys.master_files mf WHERE RIGHT(mf.physical_name,LEN('$Base')) = '$Base' UNION ALL SELECT 'NoDb' AS db WHERE NOT EXISTS (SELECT DB_NAME(mf.database_id) AS db FROM sys.master_files mf WHERE RIGHT(mf.physical_name,LEN('$Base')) = '$Base');" ;

if($result.DB -eq "NoDb" -and $file.Extension -ne ".cer"){Remove-Item $base}}

It’s a very simple script. It takes a UNC and a server instance and then walks through the files in the UNC and validates whether or not those files exist within databases on the server. If they don’t exist, it deletes them. That’s it.

I’ve published this to the Technet Script Center Repository right over here. I’m going to work on making it a bit better, so for updates, go there.

Jun 23 2010

Learning Powershell

I’ve been attending a Powershell fundamentals class with Don Jones (blog|twitter). If you read my blog you might be aware of the fact that I’ve posted a few PowerShell scripts in the past.  So why was I attending a fundamentals class? Because I didn’t know what I was doing. I knew going into the class that I needed a better grounding in the fundamentals of Posh, but after the first day of Don’s excellent class, I realized that I had been working with PowerShell and didn’t have a clue how it really worked.

Don’s class is excellent and I could spend a lot of time talking about just that (which I’m sure would make Don happy). However I want to concentrate on something that he said during class that really resonated because I think it’s true. You don’t hear “true” things all the time, so when one jumps up and bites you, it’s worth paying attention. I don’t have his exact quote written down, so this will be more than a bit of a paraphrase. Don laid down the argument that Microsoft is creating a two tier structure where low level admins will have a GUI and the real experts will be using PowerShell. He showed how some of the functionality available in AD is already split and he said that more and more products coming out of Microsoft are going to be showing this same split.

So why do I see this as important? Well, it’s simple really. I don’t want to be in the low level, second tier, LOWER PAID, MORE EASILY REPLACED, set of knowledge workers. I want to be in the group that really can make things go. I want to ensure my employability into the future (at least until I win the lottery… which will happen right after I start playing it). You may not like PowerShell. You may not like Microsoft, SQL Server, Windows or any of that stuff. You may be a devoted Mac-head (like Don, Brent, Aaron..). But if your job is related to managing Windows servers, SQL Server, Operations Manager, SharePoint, Exchange… you get the idea, regardless of how you feel about PowerShell and the rest, if you want to be better, more powerful, and more employable, you need to learn PowerShell.

The good news is, it’s not that hard. The better news is, you can contact Don and get into one of his classes. The even better news is, if you’re a lazy, good for nothing lay-about, like me, learning PowerShell will make you more efficient, which means more time to lay around doing nothing while still looking good for the boss. So for those of you who believed that they just didn’t need to learn PowerShell… well, you’re wrong. Go get started. I’d suggest learning the fundamentals first, not just hacking away at it like I did. Don’s book might be a good place to start (TFM…. [snicker]).

May 11 2010

Recompiles and Constant Learning

When faced with a procedure that looks like this:

CREATE PROCEDURE dbo.TestProc (@TestValue INT)
AS
BEGIN
IF @TestValue = 1
BEGIN
SELECT *
FROM Sales.SalesOrderHeader AS soh
JOIN Sales.SalesOrderDetail AS sod
ON soh.SalesOrderID = sod.SalesOrderID
WHERE soh.SalesOrderID = @TestValue
END
ELSE
BEGIN
SELECT *
FROM Production.Product AS p
JOIN Production.ProductDocument AS pd
ON p.ProductID = pd.ProductID
WHERE p.ProductID = @TestValue
END
END

I used to suggest creating a wrapper procedure in order to avoid the recompiles that occur when the different paths through the IF statement are taken by the optimizer. I mentioned that recently on a post over at SQL Server Central. Gail Shaw (blog | twitter) asked me why I thought there would be a recompile. She said that the optimizer took the query as a whole and created plans for it. I never seem to learn my lesson, so I suggested that she might be wrong about that. Gail being who she is, immediately went and made up a quick little test with simple queries. Sure enough, no recompiles. Ah, but I figured she was benefiting from trivial plans or something, so I created the procedure above to test the theory out. Each query, while relatively simple, goes through a full optimization process, so no trivial plans involved…

Short answer, Gail’s right and I was wrong. I don’t know where I got the idea that this type of query caused recompiles. I have now tested it on 2000, 2005 and 2008, no recompiles anywhere. I also cleared the cache, ran the procedure once, and then checked the cache using this query:

DBCC freeproccache ;

EXEC dbo.TestProc

@TestValue = 1 ;

SELECT deqp.query_plan

FROM sys.dm_exec_query_stats AS deqs

CROSS APPLY sys.dm_exec_query_plan(deqs.plan_handle) AS deqp

This is what I saw:

 

I swear, I’d never seen a plan like this before. I guess partly because I tend to only look at the actual execution plan rather than the estimated plan. It’s pretty clear that the optimizer just walked through and determined that there was more than one query involved and built a plan for them, including the conditional IF statement. If I’d just bothered to look at the estimated plan one time, I could have avoided my error of understanding.

To all those I’ve suggested wrapper procs in order to avoid recompiles… oops, sorry.

Sep 15 2009

More Free Training

Quest Connect 2009, taking place in October 21 for 24 hours, looks like it’s going to have 64 different sessions, live and recorded, by a variety of the names in the industry. It’s another chance to dig in and learn the details on a variety of topics from some of the top names in the business. Can you say Tom LaRock? How about Tim Ford? I know you want to hear from Brent Ozar. Those are just some of the featured speakers. There are a whole slew of others, it’s worth pursuing, and did I mention, the price is right.

I recorded a session for them last night. It’s on the basics of understanding execution plans.