Click here to monitor SSC
Av rating:
Total votes: 47
Total comments: 11


Phil Factor
Phrenetic Phil and the SQL Shootout
03 February 2009

Phil Factor turns to burlesque in order to reinforce his point that an ability to answer SQL Technical questions isn't really a measure of anyone's fitness for a real job of work. He is struck by the expression 'SQL Shootout', and the rest is left to his over-active imagination.  The first SQL Cowboy story?

When he first strode into the saloon through the swinging doors, out of the blinding sunshine, the interior seemed dark as sin. All that met his senses was the music from an old upright piano, and the smell of sweat and whiskey.  As his eyes became accustomed to the light, he gradually discerned the long mahogany bar, being polished in a desultory manner by a balding barman in a waistcoat, who eyed him surreptitiously. 

‘Desperate’ Dan McGehee strode over to the bar. The dust of the desert trail had penetrated his soul. There was only one remedy.  “I’ll have an orange Juice”, he muttered to the barman and placed his hat on the bar counter. The barman shot back a hostile glance.

“It’s whiskey, Scotch, straight, barley, corn, rye, bourbon, sour mash, or straight, mister.”

Dan looked around. At the end of the bar, a small gaggle of wranglers and cowhands had stopped their Grand Hazard dice game and stared impassively at him.  The piano player sat on the piano stool swaying in time to the music of an old Irish ballad, and a couple of blowsy hussys  leaned against the piano, nodding in time to the music. In the middle of the room, a smartly dressed group of local shopkeepers played poker around a table.

One of the cowhands slowly swaggered up to Dan. “Ah guess you ain’t from around these parts, stranger. “ There was a sudden flash of recognition.”Well I’ll be dawgone;  So,” he started, sneeringly “it’s Desperate Dan McGehee, I see.” He leered and spat noisily into the sawdust.  “Yew think you’re so danged quick on the draw with yaw answers to SQL Questins? But ah think you don’t know nuttin”. He swayed unsteadily.

The bartender put down the Sour  Mash.  “Take no notice Dan, it’s just the bourbon talking.” He looked anxious. “We don’t want no trouble with those goddamned SQL Quizzes or SQL Alphabets here.”

The cowhand plunged on regardless. “If you’re so damned smart, then see if you can answer this question.”  He turned to his friends at the end of the bar and winked.

Dan looked up from his Sour Mash.  He gently laid his hand on his ‘Staneck’ -SQL Server Administrator’s Pocket Consultant. “Just settle down friend, unless you want some ‘Best Practice’ bullet-points where the sun don’t shine.”

Suddenly, the bartender dived under the bar, and the piano player stopped playing and made for the rear exit of the room.

“OK Pardner”  shouted the cowhand menacingly, “which isolation level do you choose in order to prevent dirty reads , phantoms and non-repeatable reads?”,

Before the words were out of his mouth, Dan had spat out “Serialisable!”.  A look of startled surprise and disbelief flickered across the cowhand’s face until he fell, as if poleaxed, into the sawdust.

For a few seconds that seemed like eternity, everyone in the bar turned their pale faces towards Dan.  There was a shocked silence. One of the wranglers started to creep up the stairs to the balcony.

“Well”, said Dan, “if that’s all the questions, I’ll take my leave of all you good folks”

“Not so fast!” said a cowboy, “With a distributed transaction, Under what circumstances are calls to remote stored procedures executed outside the scope of a local transaction?”

Dan glanced across, contemptuously. “If REMOTE_PROC_TRANSACTIONS is set to OFF, then the work done by the remote procedure is not rolled back if the local transaction is rolled back.”

There was a squeal from a brightly dressed girl by the piano, and, suddenly, the cowboy’s head slumped forward onto the mahogany counter. Slowly he slid off his chair to the ground.

Dan dusted himself down and started to put on his cowboy hat. Suddenly, from the balcony came a menacing voice. “What is a niladic function. Where would you expect to use it?”  and another “ How does an independent subquery differ from a correlated subquery?”  The critters were firing SQL questions from the balcony!

“Niladic functions don’t take parameters,  pardner;” Spat back Dan, “and an Independent subquery  is run only once whereas a correlated subquery is run for every row in the outer query.”

There was ghastly crash and a thud as a cowboy fell through the banisters.  The saloon girls ran twittering and squeaking with fright to their bedrooms. One of the card-players looked up from the game of cards and stared reproachfully.

“Now looky here stranger,” said the severe-looking man, “You’re creating a goddam disturbance here with your quickfire SQL Answers. It’s time for you to ride out of town.”

“Eh? Who says?”

“Ahm the Sheriff in this town, and what  ah says is the lawh.”

Suddenly, the entrance to the saloon darkened as a black figure filled the entrance. “I say you chaps, is everything all right? Spot of bother?  Who’s game for a round of Nethergate Beer?”  Everyone in the saloon gasped with fear.  In the wild West, the name of ‘Phrenetic Phil’ Factor, the man with the silver bullet points, was legendary.

As the old song goes

‘Down in Arizona where developers hide,
and there’s no book to guide you save ‘The Dummies Guide’,
the roughest, toughest, man is still 
that old ‘Phrenetic Phil'.

He speaks in verse (he speaks in verse)
In a convoluted doggerel or worse
In a meter and a scansion that’s perverse
Whist he answers SQL questions 
He can  even answer,  rhyming, in a good split-second timing,
How they run, when they hear the fellow coming for the western folks all know,
He’s a versifying, death-defying,  programming geek from East of Cambridge
Old Phrenetic Phil. 

He was renowned for being the only SQL Quick-shooter who could answer SQL questions in verse.

“Take it easy, real easy!” spoke the sheriff, suddenly perspiring, “we’re peaceable folks around here, and don’t want no trouble”

All of a sudden, the stricken wrangler stirred himself in the sawdust, and, shaking his head, saw the looming figure of Phil .  Before he could be restrained, he shot out the fateful words “OK, smart guy, what’s a clustered index, then?”

There was a breathless pause as every eye in the room swiveled to look at Phil. Without blinking he declaimed….

"If you make a clustered index on a table, as you should
and you choose the columns wisely then retrieval should be good;
for the order, at leaf -level  of the table rows will  be
In the order specified according to the clustering key
Data pages, doubly-linked, are  in the list and hold the data
of the table, In this sequence, so it can be accessed later"

"Logical not physical, the order of the table rows
Not the order at disk-level , as a newbie might suppose
SQL Server doesn’t have to use a pointer to the table
For the index has the data so the database is able
to retrieve the data quickly from the data pages, so
If you choose your clustered index wisely, watch your queries go"


There was a groan, and the wrangler’s head once more hit the deck.  A moment’s pause, then suddenly, the pianist was back at his post, attracted by the hypnotic rhythms of Phil’s verses.  At first hesitant, and then with increasing confidence, the old upright jangle-box rang to the melody, until the occupants of the saloon burst into the Song of the Clustered Index, all animosities forgotten.

---+---

Later that evening, as the sun set behind the distant Mount Baldy, Phil and Dan set off once more down that long desert trail.  ‘Time to be moving on, Phil,’ said Dan, contemplatively, ‘’cause a man’s gotta do what a man’s gotta do.  Simple work; close to nature.  Always on the move:  Presentations, consulting work, SQL rodeo,  bit of blogging” .

“Yes, but it’s a good life, leaving behind them ‘all hat and no SQL’ greenhorns; just as long as someone out there needs their data corralled; but I sure could do without those darned SQL Shootouts.” replied Phil as they rode on together into the night.



This article has been viewed 6865 times.
Phil Factor

Author profile: Phil Factor

Phil Factor (real name withheld to protect the guilty), aka Database Mole, has 25 years of experience with database-intensive applications. Despite having once been shouted at by a furious Bill Gates at an exhibition in the early 1980s, he has remained resolutely anonymous throughout his career. See also :

To translate this article...

Search for other articles by Phil Factor

Rate this article:   Avg rating: from a total of 47 votes.


Poor

OK

Good

Great

Must read
 
Have Your Say
Do you have an opinion on this article? Then add your comment below:
You must be logged in to post to this forum

Click here to log in.


Subject: This.Is.AWESOME!
Posted by: Michelle Ufford (not signed in)
Posted on: Wednesday, February 04, 2009 at 10:11 AM
Message: Your SQL verse is truly inspired. :)

Subject: Not so fast there...
Posted by: Charles Kincaid (not signed in)
Posted on: Wednesday, February 04, 2009 at 10:36 AM
Message: "Ah tolt him that he was so densified that he wert able to find hit hat wiff both hands. Whilst he tryed ta prove me wrong I took dead aim and fired."
I'd rather have a right answer than a fast answer.

Great article Phil. It taught me something too.

Remember to keep your barrel clean, friend.

Subject: using formal logic
Posted by: Alex_Kuznetsov (view profile)
Posted on: Wednesday, February 04, 2009 at 12:21 PM
Message: While I agree that "an ability to answer SQL Technical questions isn't really a measure of anyone's fitness for a real job of work", usually another assumption is made: "an _IN_ability to answer SQL Technical questions strongly correlates with anyone's _UN_fitness for a real job of work"

Subject: Bad Yankee Bogus Accent and...
Posted by: zenon (view profile)
Posted on: Wednesday, February 04, 2009 at 12:41 PM
Message: Phil: you don't understand the accent you are attempting to imitate in your, uh, literature. And you misapprehend the kinds of questions that must be asked of the DBA wannabees.

The most important technical questions have nothing to essoterica in SQL Server and everything to do with understanding basic principles that apply to every DBMS except Netezza, Teradata and possibly Oracle.

Those questions revolve around disks, query efficiency, CPU, memory and basic structures like procedures and views.

Technical questions don't prove who is a guru. They prove whether or not you understand the subject matter.

In the future, avoid the unattractive British tendency to pretend to be part of other English-speaking cultures.

Subject: Re: Bad Yankee Bogus Accent and
Posted by: Phil Factor (view profile)
Posted on: Wednesday, February 04, 2009 at 1:11 PM
Message: Sorry, Zenon. I was just trying to satirize the language and spelling in the old sixties cowboy stories and comics, and old B movies. I was hoping to make that more obvious by using the old illustrations, and the cliches from the old films.I first tried writing all the parts without doing any accents and it just seemed odd. I can see how mimicking current accents would be offensive and irritating.

I used these SQL Questions purely because they were precisely the ones I was asked when applying for a DBA job last year. I felt they were most unreasonable too.

Subject: Good stuff
Posted by: Mist (not signed in)
Posted on: Wednesday, February 04, 2009 at 2:42 PM
Message: Everyone is entitled to their opinion but Zenon's nitpicking and criticism of what is obviously an attempt at entertaining writing (and a successful one in my view) seems rather over the top!

Got a laugh from me anyway ;-)

Subject: iTunes?
Posted by: Michelle A. (view profile)
Posted on: Wednesday, February 04, 2009 at 3:58 PM
Message: Can I get "Song of the Clustered Index" from iTunes?

This is priceless!

It reminded of me of my days in Geometry class when I got extra credit for writing a song called Rhombus the Quadrilateral (to the tune of Rudolph the Red Nose Reindeer).

Subject: Re: ITunes
Posted by: Phil Factor (view profile)
Posted on: Wednesday, February 04, 2009 at 4:23 PM
Message: If I'm invited to PASS, I'll sing the whole of 'Old Phrenetic Phil' which is to the tune of 'Ragtime Cowboy Joe'. (I find to my amazement there are people who don't know the great song, 'Ragtime Cowboy Joe'! Great heavens!)

Subject: Fan-Bloody-Tastic
Posted by: Anonymous (not signed in)
Posted on: Wednesday, February 04, 2009 at 4:37 PM
Message: What can you say. Apart from give the words of "Clustered Index" to Nickelback or Green Day or the Rolling Stones and get them to gig the next PASS or TechEd. Now there's guarenteed bums on seats !!
Well Done Phil, as always.

Subject: My subject line must be between 1 and 80 characters
Posted by: orcus (view profile)
Posted on: Wednesday, February 04, 2009 at 6:14 PM
Message: To Phil, the factor, that brightens up our day,
Who separates the Chaff from Hay,
With wit and verse
Somewhat perverse
We wouldn’t have you any other way.

Subject: from arizona
Posted by: sagreene (view profile)
Posted on: Monday, April 06, 2009 at 6:54 PM
Message: You nailed the accent, dead on, pardner.

 
























Seth Godin: Big in the IT Business
 Seth Godin has transformed our understanding of marketing in IT. He invented the concept of 'permission... Read more...

Geek of the Week: Don Syme
 With the arrival of F# 3.0 Microsoft announced a wide range of improvements such as type providers that... Read more...

Raw Materials: Derek in Therapy
 Our DBA gets in touch with his inner circuits. Read more...

Raw Materials: The Eyes of Derek
 Keeping Developers in the Proper Frame of Mind. Read more...

Raw Materials: Summer on the Lake
 Derek gets away from it all. Read more...

Linus Torvalds, Geek of the Week
 Linus Torvalds is remarkable, not only for being the technical genius who wrote Linux, but for then... Read more...

The Future of Reflector
 Simple Talk asked freelance writer Bob Cramblitt to sit down with the two people behind the agreement... Read more...

Driving up software quality - the role of the tester
 Have you ever wondered what a software tester does? Helen Joyce, test engineer at Red Gate software... Read more...

Bad CaRMa
 From hope and euphoria, to desperation, firings and the ultimate demise of a company. Tim Gorman charts... Read more...

Coming Out as a Cancer Survivor - A Guide for Software Developers
 A personal perspective on the responsibilities of a cancer-surviving software developer Read more...

Over 400,000 Microsoft professionals subscribe to the Simple-Talk technical journal. Join today, it's fast, simple, free and secure.

Join Simple Talk