I just (at the time of initially writing this anyways) finished up my second attempt at one of the T-SQL Challenges ( http://beyondrelational.com/blogs/tc/default.aspx ), and feel much better about this submission. The first one worked… but it just seemed too slow. It finished in well under a second on my dev machine, but knowing that you’ll be putting your responses up against some of the greatest minds in the industry really makes you think twice. I thought about it a bit more and decided to come back at the problem from a completely different angle. The second attempt was an improvement of more than 100%. Thinking that much about a problem makes me take a step back and look at all the things I take for granted in my day to day coding. Had this been a query written in normal development, I likely would have been perfectly happy to leave it at the first attempt. Reastically, it probably would have been even less efficient than my first attempt, because I was already trying to pull every ounce of speed out of it the first time. Things that you do so often that they become routine aren’t always the best way to approach every problem, and these challenges force you to really sit back and think about all the different ways you could tackle a given problem.
I personally find the logic puzzles and challenges extremely rewarding, regardless of whether I win them or not. I get the chance to sit at home with a beer and come up with a solution to a (usually) complex problem, and then see how my peers would handle the same situation. I would encourage anyone who regularly writes T-SQL to give these a shot. Even if you don’t think of the best solution yourself, thinking that hard about a problem makes looking at the winning solution that much more meaningful. They have beginner challenges as well.
Also, I believe Phil Factor is doing similar challenges (http://www.sqlservercentral.com/blogs/philfactor/archive/2009/10/25/phil-factor-sql-speed-phreak-competition.aspx). Although I haven’t had a chance to check those out yet, I look forward to doing so in the near future.
I just (at the time of initially writing this anyways) finished up my second attempt at one of the T-SQL Challenges on BeyondRelational.com, and feel much better about this submission. The first one worked… but it just seemed too slow. It finished in well under a second on my dev machine, but knowing that you’ll be putting your responses up against some of the greatest minds in the industry really makes you think twice. I thought about it a bit more and decided to come back at the problem from a completely different angle. The second attempt was an improvement of more than 100%. Thinking that much about a problem makes me take a step back and look at all the things I take for granted in my day to day coding. Had this been a query written in normal development, I likely would have been perfectly happy to leave it at the first attempt. Realistically, it probably would have been even less efficient than my first attempt, because I was already trying to pull every ounce of speed out of it the first time. Things that you do so often that they become routine aren’t always the best way to approach every problem, and these challenges force you to really sit back and think about all the different ways you could tackle a given problem.
I personally find the logic puzzles and challenges extremely rewarding, regardless of whether I win them or not. I get the chance to sit at home with a beer and come up with a solution to a (usually) complex problem, and then see how my peers would handle the same situation. I would encourage anyone who regularly writes T-SQL to give these a shot. Even if you don’t think of the best solution yourself, thinking that hard about a problem makes looking at the winning solution that much more meaningful. They have beginner challenges as well.
Also, I believe Phil Factor is doing similar challenges. Although I haven’t had a chance to check those out yet, I look forward to doing so in the near future.
[Edit] I originally wrote this post a couple weeks ago (I didn’t have my Blog online at the time) when the current T-SQL Challenge was 17. Number 18 just came out and this one looks exceptionally interesting. Usually I can look at the challenges and 3 or 4 ways to accomplish them immediately go through my head. Not so in this case, this one will definitely take some thought.