Author: way0utwest

  • Are There That Many GUIDs?

    This editorial was originally published on Oct 12, 2010. It is being re-run as Steve is away on vacation.

    Do a lot of people actually use GUIDs as Primary Keys? I haven’t used them much, and I would have thought that more people chose identity keys. It seems that most of the demos and examples I see from bloggers and speakers are constantly using identities.

    However an informal survey from Peter Bromberg showed that four times as many people actually had GUIDs as their primary keys. The blog actually says that GUIDs are not a good choice, but I’m not sure I agree with that. You can use sequential GUIDs, and you can avoid making them the clustered key, so I think they can work as well as anything.

    There’s nothing inherently wrong with GUIDs, and they should be unique across all of your rows. There have been some reported cases of duplicates, but for most practical purposes, especially in database work, you ought to be able to count on a GUID as unique. They even have the nice capability of being generated by clients, removing the need for an extra round trip when a client needs to insert multiple rows.

    I typically don’t use them because they’re long, hard to remember and type, and hard to view on the screen. I can’t easily compare rows in multiple tables, and it’s easier for me to work with integers.  I don’t recommend them, but if you are going to use them, be sure you understand the pros and cons, and use them appropriately.

     

  • Speaking at SQL Saturday #389 – Huntington Beach

    I’ll be traveling to CA next month for SQL Saturday #389 – Huntington Beach as well as a Red Gate DLM training session run by Ike Ellis. I’m assisting Ike in running a Database Continuous Integration class. It’s a paid for event, but you’ll learn how to set up and run a CI process with your database.

    Come.

    CI is all the rage and companies are improving their development processes, building applications faster with it. We go into depth, using Red Gate tools, on how you can get your database development working in a CI environment, and integrate it closely with your application development work.

    I don’t have details on my SQL Saturday session, but that should be coming soon. I will do a Red Gate presentation during lunch, so if you want to know how we can help you or have questions, come by at lunch.

  • The 2015 Car Update

    I love cars. I don’t love commuting, but I enjoy driving. A little over a year ago, I left the Albuquerque SQL Saturday with a few fellow SQL Server pros at 8pm. I drove the 6+ hours home to arrive at 2:30am in time to get some sleep and then be up early for a family event.

    It was hard, but I enjoyed the drive. I like the road trips.

    I used to include some thoughts on cars and technology as an editorial piece every few months. Some people like it, some didn’t, some hated it, so I stopped. However I’ve been meaning to include a few notes here, so if you don’t like cars, stop reading.

    The End of an Era

    At the end of last year, I sold my 911. That was the dream car I wanted since I was 11 or 12 and finally bought. It was the second Porsche I owned (I had a 914) and it was a little sad to let it go.

    However it stayed in the SQL Family, going to Merrill Aldrich. Here we were one morning in December before he drove away.

    Photo Dec 19, 7 26 20 AM

    This was the first time I hadn’t had a Porsche in over a decade, and I thought I might get another one soon. However I was looking for something that was larger and more comfortable to me.

    Looking Forward

    As I’ve aged, and since I’ve been driving my 2001 Suburban for a few years, I’ve wanted to have a bit more room in the car. With a bad knee (surgery last year) and again joints, I dislike getting down into cars these days. I don’t like driving our Prius and I try to rent SUVs when I’m traveling.

    As a result, I’m looking for a mid-sized SUV. The Suburban has been great, but it has 180k miles on it, things are breaking, and I’d like to have a slightly smaller SUV with better gas mileage. I am looking for a truck that would easily get 3 of us skiing with gear. I’ll still have the Suburban for a bit of time, so if we need to take 5 people, we can. I considered (briefly) some of the AWD cars, but at the ranch we have snow drifts at times and the low clearance of cars becomes an issue.

    I also want to be pampered. Things I think are important:

    • heated seats (must)
    • heated steering wheel (nice)
    • sunroof
    • smooth drive
    • leg room in the rear (I have kids starting to drive, who are large and sometimes put me in the back seat)

    That’s about it. Navigation, cruise control, most of the other items are optional for me. I was looking for a 2012-ish used truck, maybe newer, depending on model. With this in mind, I started a search with these cars:

    • Chevy/GMC Tahoe/Yukon
    • Porsche Cayenne
    • VW Toureg
    • Audi Q7
    • Lexus RX350/450h
    • Hyundai Santa Fe
    • BMW X5
    • Volvo XC90
    • Lincoln MKX
    • Toyota Highlander
    • Acura MDX
    • Mazda CX-9

    I drove quite a few of these, but not all. However they seemed to fall into a few classes and I could relate some to others. For example, the Cayenne, Q7 and Toureg all fall on the same frame. The Porsche is the smallest inside, and was underwhelming in terms of power. The Toureg was really nice, but it didn’t have any advantages over the X5, so I discarded it. I didn’t drive the Q7, but it’s a more expensive car, with no real advantages. To some extent, the Lincoln and Chevy fall into the same class. Expensive with no advantages.

    The Highlander, CX-9, and Santa Fe don’t feel as polished or comfortable. Thinner seats, not as enjoyable, just not luxurious. The Lincoln was a bit underpowered, and also smaller.

    I settled on the X5 and the RX350 pretty quickly. The Acura was essentially the RX350, but since there are fewer of them, why go that way? The Lexus is amazingly built, with so many older models with high mileage for sale. I even drove one with 325k miles and was tempted to get it for my son.

    Ultimately the large sunroof and my wife’s affinity for Beemers have me choosing the X5 as the truck. It has rear seat heaters, which the kids like. A third row, which is really unusable for my family (everyone is 5′ 9" or taller) but it’s there in a pinch. The sunroof is huge, which I love. It’s comfortable and luxurious, and while it’s a touch heavy, the diesel has decent gas mileage.

    All that’s left to do is find one. I’m on the search now, and we’ll see what I find in the next month.

  • Common Mistakes

    At times I am rather dismayed by the quality of code I see written today. I’m not sure it’s worse than the poor code compiled early in my career, but there are so many more people writing code in our industry that it seems there is more and more poorly written code.

    We suffer from the chef problem. As more companies look to become software companies, they need to hire more software people. To meet the staffing demand, more and more marginally skilled people will be chosen, and software quality goes down.

    Part of what we do here is to try and educate the SQL Server professionals on how to become better at their jobs. That’s really the core mission that started SQLServerCentral and continues today thanks to the belief in that mission by Red Gate Software. As we look to do that, we want to bring to light the things that aren’t good ideas and can cause problems.

    What common mistakes do you see T-SQL developers making?

    The question this week is based on a post by the talented Doug Lane, who wrote about the top three mistakes T-SQL developers make. Doug has a good list, and I’d urge you to read it, along with some sage advice from Brad McGeHee. However I’m sure many of you see different common issues in your own work.

    What things need to be fixed later? What code regularly causes performance issues? The more specific problems that you can share, along with their solutions, the more you might help another developer build better code in the future.

    Steve Jones

    The Voice of the DBA Podcast

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