Author: way0utwest

  • Off to Flowcon 2014

    With all of the work on a deployment pipeline and Continuous Integration (CI) and Continuous Delivery (CD) I’ve worked on, I thought it would be instructive to go see how the software developers build their product better. A few months ago I noticed that FlowCon 2014 was coming to San Francisco. It’s a short, easy trip for me, a 2 day conference, and I thought it would be a good chance to interact with the Thoughtworks people, as well as others.

    So I booked the trip. Even though I travel enough, I rarely go for me, and this is a good chance for me to learn. I leave this afternoon, no commitments, no presentations, just the chance for me to learn a bit.

    I’m really looking forward to seeing how people are really making software happen faster, and at a higher quality level than in the past. I’ve read a few books in preparation for this, and it’s been interesting. The first one I really liked, though it has a lot to absorb. The second two were ok.

    continuousdelivery

    Continuous Delivery – Worth the read.

    51b0kaalNnL._BO2,204,203,200_PIsitb-sticker-v3-big,TopRight,0,-55_SX278_SY278_PIkin4,BottomRight,1,22_AA300_SH20_OU01_

    Refactoring Databases – Not bad, and certainly this gives some ideas for the challenges of database changes.

    510giluHAvL._BO2,204,203,200_PIsitb-sticker-v3-big,TopRight,0,-55_SX318_SY318_PIkin4,BottomRight,1,22_AA318_AA300_SH20_OU01_

    Recipes for Continuous Database Integration – Meh

  • Advice for Steve Jones

    I was tagged by Mike Walsh in a blog post entitled: 4 Attitudes I Wish I Had Earlier as a DBA. It’s a look back at Mike’s career and a few things that he wishes he’d known earlier in his career. These are four mental ways of viewing the world, soft skills that might have made more successful, or successful faster. Mike asked a few people to share their thoughts, and there are some good ones from Brent OzarErin Stellato, and my favorite Aunt Kathi.

    I’ve got lots of advice for the young Steve Jones. I’ve had a successful career, with few regrets, and I think a small number of decisions I would undo. However I have some advice for myself, based on things I’ve learned, or things I’m still learning.

    There is no Plan
    There is no master business plan, and the people making decisions don’t necessarily make the best decisions. They’re not right, but they are in charge. Argue your position, give your professional opinion, and when the decision is made, support it and make it work.

    Take a breath
    Before you rush into decisions or actions, especially in a crisis, take a breath. It’s better to be a little slower than compound one mistake with another.

    We’re not saving babies
    Most of us don’t work on systems that affect human life. If you do, that’s fine, but for most of us our jobs aren’t that critical. Learn to keep things in perspective, and try to help your boss remember that as well.

    Be your own person
    Be honest with yourself. What do you like, and more importantly, what do you not like. It’s easy to get caught up in what others think. It’s easy to let yourself get drawn into a path that is not your own. Choose your own path, but more importantly, learn where your path really leads.

    I’ve written a bit more, a slightly longer post on my blog with a few more items. However these are the pieces of advice I’d have liked to have learned earlier in my career. Perhaps hearing one of these items will help one of consider yourself a success a bit sooner in career.

    Steve Jones

    The Voice of the DBA Podcast

    Listen to the MP3 Audio ( 2.7MB) podcast or subscribe to the feed at iTunes and LibSyn. feed

    The Voice of the DBA podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music.

     

  • Crosstabs over Pivots

    I wrote about a basic PIVOT query recently. It’s an interesting way to write a query and turn row data into columns. That’s handy, and lots of people have a need for it. However I’d never used PIVOT in production code. I’ve always written a crosstab query instead.

    If I look back at the query I wrote, it looks like this:

    select
        *
      from
        ( select
              team
            , opponent
            , teamscore
            from
              scores results
        ) as rawdata 
    
    pivot
    
     ( avg(teamscore) for [Opponent] in ( [KC], [OAK], [SD] )
    
     ) as pivotresults;

    This gives me these results:

    team   KC   OAK  SD

    DEN    31   35   24

    However I could also write this query:

    select 
        'team' = team
    ,   'KC' = sum( case when Opponent = 'KC' then TeamScore else 0 end) / 2
    ,   'OAK' = sum( case when Opponent = 'OAK' then TeamScore else 0 end) / 2
    ,   'SD' = sum( case when Opponent = 'SD' then TeamScore else 0 end) / 2
     from scores s
     where team = 'DEN'
     group by team

    That gives me the same results.  The AVG item gets tricky as can don’t want zeros to be included in results. If there were a dynamic number of scores, I’d have to write a few subqueries to solve this issue.

    Which one is more clear and easier to understand? That’s a good debate. However I will say that if I need to add a column, I think it’s easier to do so in the crosstab.

    select 
        'team' = team
    ,   'KC' = sum( case when Opponent = 'KC' then TeamScore else 0 end) / 2
    ,   'OAK' = sum( case when Opponent = 'OAK' then TeamScore else 0 end) / 2
    ,   'SD' = sum( case when Opponent = 'SD' then TeamScore else 0 end) / 2
    ,   'NE' = sum( case when Opponent = 'NE' then TeamScore else 0 end)
     from scores s
     where team = 'DEN'
     group by team
    ;

    Here’s the PIVOT:

     select
        *
      from
        ( select
              team
            , opponent
            , teamscore
            from
              scores results
        ) as rawdata
      pivot 
       ( avg(teamscore) for [Opponent] in ( [KC], [OAK], [SD], [NE] ) 
       ) as pivotresults;

    I’ll also point out that Jeff Moden has written a few articles on this subject (Part 1 and Part 2) and his performance analysis shows that a crosstab performs better in almost all cases.

    I wouldn’t recommend one over the other. You need to test them both at larger than expected data sets to determine which one works in your situation.

  • Happy Labor Day 2014

    Happy Labor Day to everyone. It’s a holiday in the US, so a break from labor for many of us, but those of you outside the US are probably hard at work, so I hope you have a very productive, stress-free day.

    Labor Day was conceived as a workingman’s holiday, and should celebrate the efforts of workers at their crafts. It was an attempt to heal relations between railroad workers and companies in the wake of the Pullman Strike, but has also come to mark the end of summer and beginning of school for many in the US, though many educational institutions have already started the new year in August.

    With that in mind, I’d like you to stop and think for a minute about the things you build or work on. Think of something that you are proud of having worked on. I hope that you have a few fond memories of work that has gone well in your career.

    I’ve built lots of software, and there are quite a few systems I’m proud of. I worked to rewrite an inventory application for an import business, a data center management application for one large company, and even a few reports that I thought were very useful and valuable to my employers. I didn’t build most of the software running this site, but I do think that SQLServerCentral as a total entity is the thing I’m most proud of. I’m not sure if my fellow founders, Andy Warren and Brian Knight, feel the same way, but I’m quite pleased that I’ve been able to help many SQL Server professionals get better at their jobs.

    Steve Jones

    The Voice of the DBA Podcast

    Listen to the MP3 Audio ( 2.0MB) podcast or subscribe to the feed at iTunes and LibSyn. feed

    The Voice of the DBA podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music.