Shut up and play yer guitar…

I\’ve had the rare luxury of being away from work this week, and boy did I need that !


Apart from the opportunity to reconnect with parts of life that had been pushed to the side somewhat (and hack down the wild Eucalyptus tree in the garden), I\’ve also had the chance to be a bit philosophical about SQL.


Does that make me sound like a basket-case ? (Don\’t answer that !)


Here\’s the nugget that I\’ve come up with for your consideration:


\”It depends.\”


As I\’m sure you know, this is the DBAs answer to a straight yes/no question, as in:


\”Would using a CTE and a join improve performance ?\”


\”It depends….\”


The philosophical part was wondering if there were any other walks of life where ambiguity was baked-in in the same way. So, I picked up my guitar, and went in search of enlightenment. And a cold one (I\’m on holiday, after all).


Little did I realise, but the answer was right in front of me. Literally.


Guitar chords are almost exactly like SQL, in that the chord you use depends on the sound you want to make at that point in the tune. And I\’m not talking about different chords (like a G or an A Minor), but variations on the SAME chord.


As evidence of this, open your favourite search engine. and look for the chord patterns for E/G# (or look at this site, if you need instant gratification).


E/G# sounds like quite a specific chord – it\’s an E, with an added G#. But there are over 50 ways of making that sound. And which one you use is predicated on several things: 


Does it make the right sound ?
How hard is it to play ?
What is are the preceding and subsequent chords ?


I could go on about how to place your fingers on the fretboard to play the chords (barre, half-barre, double-jointed, etc), but I won\’t. I\’m sure you get the point.


So, when faced with the question about CTEs, it\’s perfectly valid to say \”It depends…\” as long as you\’ve got a list of things to take into consideration when making the choice.


For the record, I\’d look at what is actually being attempted, indexes, aggregations, table-valued parameters, CROSS APPLY,…..


Maybe I should just stick to \’Hallelujah\’ by Leonard Cohen. The version I\’m playing has an E/G#. Other versions don\’t. Which one is right ? I kind of think it depends….


Back soon !



Leave a comment