Category: Blog

  • Data Compression in SQL Server

    Do you know much about data compression? It seems that quite a few people I meet don’t really understand how it works, or what the benefits are. I heard about compression first hand from Sunil Agarwal a few years back at TechEd. I visited one of his sessions and then he was gracious enough to spend about 15-20 minutes with me afterwards answering more questions about additional details. At the time, I was just another schmuck in the audience, but Sunil was very pleasant and patient with me.

    I was lucky that day,but Sunil has a video where he explains some of the ways in which compression works for Microsoft customers.

    http://channel9.msdn.com/posts/SQL-Server-Data-Compression/player?w=512&h=288

    The summary is that data compression works in a few ways. One is, obviously, to save space. The second, however, is that fewer I/Os’s are required to move data onor off a disk, which can result in a performance increase. The SQL Server team tried to strike a balance in how they implemented compression to allow for both of these benefits. The tradeoff is that CPU is needed to compress or decompress data, so while more compression is possible, it can negatively impact performance.

    Compression is a cool feature, and consists of a few parts. You can read more about each of them if you are interested:

    The DBA has complete control over what is compressed, but it is also some work to analyze the space savings and then make a determination about whether or not it is worth you compressing your table. If the space savings is too small, you might end up negating any storage gains with additional CPU costs.

    How Do I Decide?

    There is a stored procedure (sp_estimate_data_compression_savings) that can be used on tables or indexes to help you determine what the savings are. Numerous scripts are available, like this one from Paul Neilsen – Whole Database – Data Compression Procs.

    There’s also one easy decision. Only Enterprise and Data Center editions of SQL Server support this feature, so if you aren’t running those, you don’t have to worry about this.

    Alternatives

    There are a couple other alternatives to implementing data compression.  If you want to get compression savings in other editions of SQL Server, my company, Red Gate Software, makes a product called SQL Storage Compress, which implements compression at the file level.

    This is based on Hyperbac technology and is completely transparent to SQL Server. We are working on some extensive case studies now and this is part of the SQL Server I/O Reliability Program, but this can help performance on your system by reducing I/O.

    If space is an issue in test, customer service, and development environments, you can use Virtual Restore to mount a backup file as a database that you can read, or write to. The writes occur in a sparse file, so your backup file is untouched. However you get a quicker “restore” that is transparent to SQL Server.

    As I mentioned, I work for Red Gate software, so take these as mentions of products my company builds and sells. I’ve heard great things about them, and use them in a few places for work at SQLServerCentral. I’d recommend you try them and see if they are a fit in your environment and have a good price/value ratio for your company.

  • Evaluating Sessions You Attend

    I have seen more than a few posts about feedback that speakers get from sessions in the last couple months. Last week Buck Woody made an attempt to build a better form that could be used for feedback, which I like, but I think it’s a little too long for most events. If you attend 3-6 sessions in a day, filling out forums like this could be a chore.

    Attendees Should Give Feedback

    I know your time is valuable, but please give some feedback. I agree with Buck that the numeric scores are useless, but I know organizers wants something. If you liked the session, give it a 10, if it was OK, a 5, and if it didn’t work for some reason, drop a 1 in there and leave it at that. Let’s just make it a simpler system because no one knows what a 6 is vs a 7.

    But Be Fair.

    The way you perceive a session is not the way everyone else does. If you think the speaker was technically wrong, tell them. If they didn’t cover what was listed in the abstract, tell them. If they wandered around the topic without making sense, tell them.

    But don’t mark up a form with bad scores because you didn’t like their music, or their shirt, or don’t agree with the approach or thought something was too (or not enough) technical. More often than not I find people are so subjective in this area, and the inappropriately send information to other attendees, or impact the speaker’s ability to present in the future.

    If you have specific complaints, speakers would appreciate hearing them. You don’t have to rate everything, but give one specific piece of criticism that you’d want changed. One thing Buck does well is give you a chance to impact a presentation, and you ought to drop one written comment (not a score) on each evaluation you turn in.

    If you don’t have something bad to say, say something.

    I know that many evaluations are used for raffles, so please feel free to fill them out quickly, but I would appreciate some feedback. I do like seeing all 4s or 5s on my scores, but they often don’t help me improve the presentation. Give me one thought about what I could do better.

    For Speakers

    If you’re a speaker, you have some idea of what goes into building a presentation, writing a description, developing flow in your presentation, and pacing. Therefore, you ought to be able to evaluate a few things for other speakers.

    You ought to be able to tell them if they hit their mark in terms of what they said they’d deliver. I think speakers often have a better perspective on evaluating this. Not that non-speaking attendees’ opinions don’t count, but they sometimes aren’t very well thought out

    If you know the speaker, drop them an email, or take a (private) moment to give them an assessment of what you thought. I routinely let others know when I think they could improve something, or have approached a session in a way that turned me (or others) off.

    If you don’t know the speaker, introduce yourself, and say “I have some constructive feedback on your session. You don’t have to do this, but I thought …”  and then explain your point of view. It’s not rude, or assuming, and believe me it’s appreciated.

    Just be aware that it’s an opinion and don’t get upset if the speaker doesn’t make the change you mentioned. You’re still one of many, and while it’s nice to hear your opinion, it’s not a marching order.

  • Cool Tech Tools

    Completely off topic from SQL Server, but cool nevertheless.

    I have been using Skype to communicate with Red Gate on a regular basis for video calls every week. It’s been over a year, and I’ve always had to get my laptop ready for weekly calls. I often take them in another room when my wife has a call scheduled at the same time, and it’s a slight pain. It also means that I sometimes interrupt what I’m doing on the desktop when I have a call, which is annoying.

    I downloaded the Skype app on my iPhone awhile back, and I’ve used it for calls with family, but never for work. It didn’t buy my anything since I’d need to hold the iPhone up, which defeats some of the purpose as I can’t look something up on the call, which I often do as we refer to data, prototypes, or something else.

    I have had a GorillaPod for sometime that I’ve carried in my laptop bag for use with my camera

    41rh8oPpSLL._AA300_PIbundle-1,TopRight,0,0AA300_SH20_

    I decided to search around and see if I could find some mount for the iPhone. I have one that lets me use it as a teleprompter, but it isn’t very portable. I ended up finding a snapmount for the iPhone. They make a bunch of other ones for various phones as well.

    31UFaJknfVL._SL500_AA300_

    It arrived recently and I hooked them together. I had a call with Andrew Clarke last week, and I decided to use Skype on my phone, rather than tracking down the laptop. It worked out pretty well, allowing me to see Andrew, and he to see me, as well as letting me still use the computer and send him a couple emails while we were chatting.

    Not the neatest desk, but it worked well.

    I paired this with my wired headphones from Body Glove, which worked well, but the cord is a little short. I like to lean back to talk when I don’t need to type, and this one is a little restricting. However it’s my favorite for traveling.

    21MRYY4KT6L._SL500_AA300_

    however I’m really looking forward to next week when I’ll use my Gogroove bluetooth headset. That will be really cool.

    41JcKvr1g1L._SL500_AA300_

  • BCPs – The Disaster Recovery Plan

    I came up with a short acronym for my Preparation for Disaster presentation: BCPs. It describes what I think you need to do in order to be prepared for issues with your database server. The initials stand for:

    • Backups
    • Checks
    • Practice and Preparation
    • Script and Schedule

    With a utility in SQL Server going by BCP, this ought to be easy to remember. I’ll describe what I mean below by each of these:

    Backups

    You need to make sure that you have backups. They are insurance for the issues that will befall you at some point. They are also required for restores, which do matter.

    You need a backup plan that meets the need for the particular system you are protecting. Not your entire infrastructure, but what’s appropriate for each system. Once size does not fit all here.

    Checks

    You can’t prevent corruption and it can occur at any time. The best you can do is detect it early, and fix it as soon as you can. Make sure you have checks in place that look for corruption.

    You also want checks for things that are out of the ordinary. Make sure you have some monitoring/base-lining set up so that you can proactively be aware of what a disaster might occur.

    Practice and Preparation

    All of the backups, checks, etc. in the world are useless if you don’t know how to apply them. Or if you don’t have the keys, passwords, account numbers, etc. Practice the skills you need to recover your systems, and make sure that you are prepared to do so in a variety of situations.

    Explaining to your CEO that you don’t have the keys for that TDE encrypted restore will make for a very, very bad day.

    Script and Schedule

    You must automate most of your job to be successful and efficient, and you ought to have lots of your DR insurance (backups/scripts) scheduled so that it get performed in a timely manner, and a regular manner. Humans forget things, and make mistakes constantly. You need to ensure that you are scripting your tasks (to speed up processes) and scheduling them (to ensure they occur regularly).