It’s American thanksgiving, and coincidentally my birthday today. I’m here at work (like a sucker) while those of you south of the border are travelling, eating, talking and thanking.
But working is a pretty good consolation prize. The alternative – not working – would definitely be worse and I’m thankful that I’m employed. I work with a great bunch of people. They’re super-creative and I do my best to fit in. What I mean, is that I’m not the best artist where I work. We have professional graphic designers on staff and I stare at what they do with envy.
But it goes beyond that too. I’m not even the best artist in my group. I work with a QA Analyst Brandon Oliver who draws for twxxd. He recently learned that it was my birthday coming up and whether he could draw something for me. I came up with the coolest thing that I could think of on such short notice: I asked “Draw a character that would be to Snarf as Chewbacca is to an Ewok”. (If you understood any of those pop-culture references in that sentence, then congratulations! You’re my kind of people) And Brandon delivered:
Takeaway: None really, I just wanted to tell a few stories and draw a bit
A long time ago, I had an interview and I was asked a question that (I’m guessing) was designed to evaluate how I approached problem solving. It went something like this:
Interviewer: “Say you’re a farmer who has a cow in a fenced field. But the fence is broken and you need a nail to fix it. The nail you need is inside the barn and if you retrieve it you leave the cow free to escape. What do you do?” Me: “I think I would just go fetch the nail. I don’t think the cow will get out” Interviewer: “But you can’t leave the cow alone” Me: “I don’t know. I’ve been around cows and they’re pretty stupid. There’s a good chance they don’t know the fence has a hole in it. It will probably take me under two minutes to get the nail.” Interviewer: “Ohh… You’re a problem-avoider.” Me:!!!
“Problem Avoider”? That label took me by surprise. And even though it wasn’t meant as a criticism, maybe I did feel a little slighted by it. The implication is maybe that I don’t face problems that ought to be faced.
Since then, when I face a technical problem I often ask myself: “Am I a problem avoider?” “Am I refusing to deal with a particular issue, hoping it will go away?” I’d like to believe that the answer to those questions is yes and no respectively: I am a problem-avoider but I do not have my head buried in the sand.
Unapologetic Problem Avoider
Sometimes taking a step back to try another approach makes the problem go away. I was asked something like this recently:
Friend: For this set of data, how do I get the min, max, median values. As well as the value at the 25th percentile and the value at the 75th percentile. Me: Oooh, I know this one…
I googled “NTILE” and was soon looking at the books online topic wondering if this was appropriate. After some thinking I decided to maybe avoid the problem:
Me: How many rows are we talking about? Friend: Umm a couple hundred… maybe up to a thousand max. Me: You can do this in C# right? Just load the entire dataset, sort it and then do index look ups after doing some arithmetic. Friend: I was thinking of that, but I wanted to know your opinion. Me: I think that’s the way to go. SQL Server already has to do the reads. The only thing we’re not saving is the network bandwidth. And that’s not much any way.
Problem avoided. But I think that the important part here is that the problem is still being faced; it’s just being faced in the right place and by the right person.
But there are times when you can’t avoid a problem and you have to take responsibility. I’m not going to preach against procrastination. Mostly because I think Nike already has the best advice.
But I want to talk about procrastination’s second cousin: Doing-fun-work-first. Man, I do that a lot. Probably too much. I still struggle, but lately, my approach has been
to prioritize things and then be as objectively honest about the priorities as possible (no kidding).
Or deal with crummy tasks first in order to “get them out of the way”.
If you got any tips of your own, send them this way…
I’ve been rewatching Star Trek again, I find I relate most to Geordi La Forge. He’s a technical guy. He wears the yellow shirt of engineering instead of the red shirt of command.
So I was inspired to write this light hearted post. I usually find non-technical posts a little wishy-washy (No offense to you Seth-Godin-types). But I liked the way this drawing turned out and I had to use it somehow right?
You may have already seen articles or websites elsewhere that detail a comparison between Star Trek operations and company operations. Well here’s another one. For the moment we’ll sidestep the lessons learned from Picard (on how to be a inspiring leader) and go straight to Geordi. Here are the lessons:
Make Everyone Believe You Can Do Anything …
Here’s how Geordi’s typically responds to requests from the captain:
Did you see what he did there? It’s not a choice between “I can” or “I can’t”. It’s also not a choice between “it’s possible” or “it’s impossible”. If Geordi can accomplish a task, he essentially takes the credit with “I can do this”. If he can’t accomplish the task, then his words imply “It can’t be done.” He never implies that his skills are lacking. So are Geordi’s skills ever lacking? No:
… And Then Make Sure They’re Right …
Even when the pressure’s on and someone calls your bluff. There’s a persistence that can pay off: RIKER: Gentlemen, we’re giving you an assignment. The one thing we don’t want to hear is that it’s impossible. PICARD: I need the transporters to function, despite the hyperonic radiation. LA FORGE: Yeah, but that’s imp… Yes, sir.
and then later: LA FORGE: Captain – we can do it. We can modify the transporters. It’ll take fifteen years and a research team of a hundred…
Most impossible things are actually just really really difficult. For example, recently I asked a question on stackexchange about avoiding downtime during a migration. The first feedback I got was the comment “I don’t think [the downtime] can be avoided” which got a couple up-votes. But it turns out there was a way; it just took a lot of effort (I blogged about that effort in this series). It’s the yellow shirt’s job to explain the “how” and “what” so that the red shirts can make informed choices.
Later on in another episode: LA FORGE: Ferengi codes are damn near impossible to break. PICARD: Gentlemen, I have the utmost confidence in your ability to perform… the impossible.
See! It paid off. But it’s easy for me to give advice that boils down to “be able to do anything” it’s another thing to make it so. How do you get great at what you do?
… By Being Awesome
Easier said than done right?
So Geordi’s got skills, and he uses those skills to build a great career for himself. But where did he get those skills? I figure you can become great at something in a number of ways:
Be talented at it (you can’t change you, but you can change fields)
Hard work. There’s no getting by without hard work. Imagine you’re on vacation sitting on a beach. You’re looking at the hut next to you and see some guy in a chair reading SQL Server Pro on his iPad. You just can’t compete with that guy. I’m not suggesting you read trade magazines on holiday, but are you in a field where you might want to?
It boils down to finding your passion. And I hope you’ve found yours. Geordi is a guy whose passionate about the latest thing in his field. It almost seems like he cares about it more than job security:
PICARD: Warp without warp drive. RIKER: They’re gonna put you out of a job, Geordi. LA FORGE: I hope so, Commander.
Antilessons From Geordi
But I like my role models the same way I like a buffet. I pick and choose the good lessons and leave the rest behind. Here’s a Geordi “lesson” that didn’t make the cut:
LA FORGE: I don’t know, Data, my gut tells me we ought to be listening to what this guy’s trying to tell us. DATA: Your gut? LA FORGE: It’s just a… a feeling, you know, an instinct. Intuition. DATA: But those qualities would interfere with rational judgment, would they not? LA FORGE: You’re right, sometimes they do. DATA: Then… why not rely strictly on the facts? LA FORGE: Because you just can’t rely on the plain and simple facts. Sometimes they lie.
I don’t buy it. I get what he’s trying to say and the sentiment is correct, but the point of view is wrong. Facts don’t lie by definition. When Geordi says that facts lie sometimes, I would say instead that the facts are incomplete, or an assumption has been made incorrectly.
Once I was asked by a developer why his code was throwing the error message:
Table ‘noidentity’ does not have the identity property. Cannot perform SET operation.
even though the table in question was showing that it did have an identity column.
I said show me. And he did. And was it the same table? It was. And was it the same database? Yes. Are you sure? Of course. Can you show me the connection string? Hang on a second…. ohhhh. (Omitted in this mini-dialogue is about 15 minutes of head-scratching on both our parts).
Yes, sometimes the facts lie… but only when they’re not facts.
More Geordi Lessons in The Comments
I’ve put a few more of my favorites in the comment section of this post. Do you have any favorite Geordi lessons (or Star Trek lessons in general)?
So I recently looked through my web statistics and I wanted to share some of my favourite search terms. These are words or phrases that people have searched for and for good or bad, they've wound up here on my site. Google Analytics helps me browse these search terms and looking through them I learned that
Michael is apparently hard to spell
Some people still include question marks in their search queries. It's quaint. I always assume they're asking "Jeeves"
Any way here are my favourites, in no particular order.
Sorry, you've come to the wrong place, random googler.
cartoon cow tossing dog
(strangely enough) You've come to the right place, random googler.
how to avoid swart
HAHAHA! If you find out, let me know.
my software never has bugs. it just develops random features
and pivot tables are like good wine you need to learn how to appreciate them
2 things: (1) How did my site come up for these searches and (2) Can we be best friends?
By the way, the phrase "You've come to the right place" reminds me of Engywook, the toothless scientist from the movie The Neverending Story. He's an expert on the Southern Oracle (it's his speciality). So I include him here in the hopes that I get at least one ironic google hit for "Oracle expert":
Have you ever written an amazing blog post that just didn’t pan out because when you reread what you wrote, you found out it was crap? That happens to me sometimes and it’s frustrating. Here are some illustrations that I’ve created in the past that just never made the cut. So I’ll just leave these here.
And just to throw in some SQL, here is a query that will return the complete lyrics to Feliz Navidad, (the most repetitive Christmas song in the world):
Feliz Navidad, ', 3)+'próspero año y felicidad', 2)+REPLICATE(REPLICATE('
I wanna wish you a Merry Christmas, ', 3)+'from the bottom of my heart', 2),3)for xml path(''),type
They Might Be Giants (TMBG) released an album called Apollo 18. It has 38 tracks and it runs for 42 minutes. It’s an album that will always remind me of my friend and first University roommate (Hey, what’s up Chris!). So the average track is about a minute long and this is due to a set of 21 tracks collectively called “fingertips”. Most of these fingertips are five to fifteen seconds long. Some are a bit longer. These fingertips are probably not good enough to be put on an album on their own. But collectively, they make a really cool album (especially on shuffle mode).
So when I found myself with a collection of tiny tips that might not qualify as a blog post on their own, I thought of that album and a microsecond later, we’ve got SQL Fingertips!
So here they are, in no particular order.
Stackoverflow tip: Use the bounty feature without being afraid of the hit to your reputation. A bounty offered on a decent question usually attracts enough attention to get your question up-votes. And unless it’s a crummy question, those up-votes will earn you back the reputation points you spent.
T-SQL tip: You can use the following script as a template to be able to run a single query on multiple databases and have it return a single result set:
DECLARE @temp TABLE(
insert @temp (ServerName, DBName, ProductCount)exec master..sp_MSforeachdb N'use [?];
if exists (select 1 from sys.tables where name = ''Product'' and SCHEMA_NAME(schema_id) = ''Production'')
exec sp_executesql N''
select @@servername, db_name(), Count(1) as [count]
SQL Server Management Studio tip: GO can take a parameter. If you write GO 100, your batch will be executed 100 times. Many people know this but I always here a couple “wow”s each time I demonstrate it. And here’s a couple more notes about that batch separator.
The batch separator doesn’t have to be GO. It’s configurable! I used to set it to ENGAGE for a while, but the joke got old and I switched it back.
Blog tip: If you like following blogs or people, but maybe you’re falling out of love with your RSS reader. No worries. You can get any RSS feed at all sent straight to your inbox. There are lots of RSS-to-inbox websites out there. The one I recommend is FeedMyInbox.com. So, for example, to get my own blog delivered to your inbox, start here.
Data → Eye → Brain, A Data Visualization tip: Data visualizations (charts, diagrams, etc..) help us gain knowledge and understand data that maybe we couldn’t understand otherwise (See Anscombe’s Quartet). And for large and complex datasets, the best visualizations are usually custom designed and interactive. There’s a lot of power in customized visualizations: See what David McCandless and Miriah Meyers have to say.
Twitter DBA Tip #1: I put a call on twitter asking people to tweet the one database tip they thought more people should know. The first one comes from @BrentO: “Don’t leave your database in full recovery mode if you’re not doing t-log backups.” He’s right. Full recovery mode usually implies a backup strategy that includes transaction log backups. (And full or differential backups are not enough either).
Twitter DBA Tip #2: This one’s from @wnylibrarian“If using SQLExpress & no SQLAgent, try using SQLCMD in a batchfile.” I’m glad Gary tweeted this one. I’ve come up against this problem in my own work. It turns out that when downgrading editions of SQL Server, often one of the first things that you miss is SQL Agent. If you follow Gary’s advice, it’s not a hurdle, it’s only an inconvenience.
Twitter DBA Tip #3: Next I heard from @DaveH0ward who wants to remind people that “You need to size your data /log files and set autogrowth amounts appropriately.” I think a lot of people don’t know that the default auto-growth settings for SQL Server databases are a bad idea. Tim Ford warns us of dire consequences for not following this tip.
Twitter DBA Tip #4: Finally I heard from @SQLSandwhiches (aka Adam Mikolaj). He shared a pet peeve “I’ve seen so many servers that don’t have logs to auto cycle. Don’t you love opening a log file with 300,000 entries?” Adam wrote about his experience earlier this year (including a solution of course).
MixedTape Fingertip Tip: Say you find yourself back in the nineties making a mixed tape and you find that you have a minute left to fill on one side of the tape. They Might Be Giants to the rescue! Pick several fingertips from their Apollo 18 album and optimize every second of that mixed tape! My personal favorite is the 45 second Minimum Wage off of their other album Flood.
So how many of these SQL Fingertips did you know? Have you got a small tip? Share it in the comments. Have you got a whole bunch of small tips? Write your own SQL Fingertip post. I’d be especially grateful to read a set of Business Intelligence fingertips.
I’m super excited about this month’s T-SQL Tuesday, for a couple reasons. First of all, this month’s T-SQL Tuesday is hosted by Brad Schulz. Brad is a guy that I got to interview a couple years ago. Second, is that the topic is Sprox ‘n’ Funx (Stored Procedures and Functions). Which I like because the topic is nice and technical.
I started out thinking that I could treat the question “Are stored procedures a good thing?” But that issue is a contentious one and it would take a book to treat that issue properly (So maybe later)
Today, I’m giving some attention to some interesting numbers related to stored procedures (the format is taken from Harper’s Index a popular feature in Harper’s magazine)
Stored Procedures By The Numbers
250: The largest size in megabytes allowed for the source text of a stored procedure.
2,100: The largest number of parameters allowed for a stored procedure.
32: The maximum number of nested levels allowed for stored procedures.
1,598: The number of mentions in sys.messages that contain the word procedure.
858: The number of mentions for function.
389,000: The number of Google results for should use stored procedures.
29,500: The number of Google results reported for should not used stored procedures.
1 in 866: The odds that a random word taken from MichaelJSwart.com is procedure.
1 in 879: The odds that a random word taken from the 2011 State of the Union address is budget.
18: The number of participating blogs in Brad Schulz’ T-SQL Tuesday on the subject of stored procedures and functions.
1875: Earliest year I could find a published mention for the word sproc*
So if you’re in Seattle this week: have fun, spread some knowledge, meet some smart people.
If you’re not in Seattle like me.
Follow Jen McCown’s blog post here: “Attend the PASS Summit from Home”. I’ll be doing a lot of this. I’ll be watching the keynotes as they’re broadcast, but without SQL Server Denali being released, I’m not sure what’s in store.
Leave me a comment here or on Twitter @MJSwart. There’s no reason not to get a little networking in
Do you remember Watson? It's the A.I. program that IBM developed that answers natural language questions. It kicked butt last year on Jeopardy. Well, IBM recently noticed that there was a large store of SQL Server knowledge to be had by looking through SQL Server questions on stackoverflow and by looking through #sqlhelp tagged questions on twitter. Well it wasn't too long before they had Watson answering SQL Help questions!
I love artificial intelligence. What could go wrong!
IBM planned to deliver Watson's software and hardware to Chicago (but somehow they got lost at Toronto's airport). With one thing and another, I was lucky enough to get involved and I'm proud to say that they let me preview their Watson vs. SQL Server solution that they've (embarassingly) called The SQL Server Help Oracle.
I've given it a spin and I have to say it's in fine form! It gives answers that are just like a DBA's answers. Without further ado... Here it is! Give it a spin! Ask away.
Introducing the SQL Server help oracle:
Your Question:Your questionThe SQL Server help oracle says:Your answer