Author: way0utwest

  • Trace Flag 2371 and Statistics

    One of the issues that I see published often on forums like SQLServerCentral is the advice to update statistics on your tables if you have strange performance issues, or sudden changes in performance. Statistics are important for the query optimizer, and you should understand the basics of how they work.

    However there’s a problem with statistics. They get out of date. SQL Server will automatically update statistics, but it doesn’t do this constantly. It does it after 20% of the table changes (by default). If you have 1000 rows, that means 200 rows changed (or added) can trigger the update. If your table has 50 changes every couple days, you’ll get statistics updated every week.

    If you have 1mm rows (think large, historical data here), then those same 50 changes won’t trigger statistics updates for a long time. 200,000 changes will be needed then.

    There’s a trace flag, 2371, that can help with the minimum needed to trigger a stats update (or you can do this with your own jobs). By choosing this, you can lower the minimum for triggering an update.

    What you do really depends on your issues. If you find poor performance in queries, look for wildly incorrect estimates of rows in your query plans. If you find that your statistics aren’t being updated, or not updated enough, you might enable the trace flag, or create your own job to update statistics manually.

    Note that if you are rebuilding indexes, you don’t need to also update statistics on the columns in the index. They are done as part of the index rebuild.

  • A Software Warranty

    pocket knife
    Shouldn’t software developers give a warranty we can potentially void?

    Years ago I worked in a large company on the operations team. We were responsible for all production issues for the 6,000 people and the assorted machines, devices, and applications that come with a large workforce. There was a department that was aligned with our group that focused on engineering and various development groups that built different applications. The engineering group was good at working closely with the production team to ensure smooth deployments, but they weren’t on call and would at times respond slowly to develop solutions when problems occurred. They were, however, better than the development groups who often sent code to be deployed, and accepted bug reports back, but provided little support or assistance for problems with their code.

    I ran across this link from a DevOps person called You Write It, You Support It in the Brent Ozar, PLF newsletter. The piece makes a case for the problems that occur with some deployments, like a lack of, or surplus, of logging, switches to turn features on/off, error handling, and more. It’s a pretty good description of typical problems I’ve often seen, and it calls for developers to support the features that they write, even in production systems.

    I like this idea, though I don’t think that it should be a continuous expectation with developers required to support their code forever. I would like to see developers giving their code a “warranty” of sorts, perhaps a couple months of priority support when code is deployed into live environments with developers taking responsibility and responding to calls, even after hours.

    There are arguments to be made that developers’ time is better spent enhancing applications and applying their creativity to new ideas, but this leads to a human frailty. Too often we view a job finished as a job completed, and that’s not always the case. Doing a job well means more than completion. It implies a level of craftsmanship and pride in the finished product, both from the developer and the client.

    Developers should write code that works. If it doesn’t, then it’s not really finished and should be fixed. With that contract in place, we usually find that the developer spends a bit more time ensuring the product is built in a quality way that reduces the need for much support.

    Steve Jones


    The Voice of the DBA Podcasts

    We publish three versions of the podcast each day for you to enjoy.

  • Unprofessional Employers

    Professional SQL SErver
    Would your employer pay for this book?

    Is your employer unprofessional?

    It’s Friday, and that’s the poll question based on this blog post. In the post, Mark Rendle talks about the fact that  we are all responsible for our professional development and career, but a professional employer understands they should also be making an investment in their developers. He disagrees with Uncle Bob Martin who says that we are solely and completely responsible for our own learning and education.

    My view is similar to Mark’s in that I think we are ultimately responsible, but that employers should bear some burden of investment in their staff, especially as they evolve and change their technology platforms. If you are hired to be a SQL Server 2008 DBA, the company can’t expect you to be skilled in SQL Server 2012 and handle deployments as soon as the product is released. A company can expect you to put some effort into learning the new platform, and perhaps over time understand how it differs from previous versions, but if the company wants you to gain that knowledge quicker, they need to invest in your knowledge themselves.

    A professional employer understands that, and is willing to put some investment into you, usually if you show some initiative and effort to learn on your own, or make your own investment (time and/or money) into improving your skills.

    I’ve been fairly lucky in that most of my employers in the past were willing to invest in me. Even the ones with very limited training budgets would provide some supplemental help if I showed them my own plan for increasing my skills. It might have been reimbursement for a book, a spare computer, or even just some time at work to spend learning something new. My current employer is one of the best, offering lots of training. Now if I could just find the time to take advantage of it ….

    Let us know this week if you have a professional employer.

    Steve Jones


    The Voice of the DBA Podcasts

    We publish three versions of the podcast each day for you to enjoy.

  • Windows Server 2012 and Hyper-V

    hyper-v
    Hyper-V looks like a great candidate for almost any SQL Server with the enhancements in Windows Server 2012.

    I recently went to a Microsoft event in Denver on Windows Server 2012 and Hyper-V improvements. A bunch of the information was presented by Harold Wong (b | t) and there’s a number of demos and notes from the talks on his blog.

    I haven’t looked much at the Windows server OS’s in years and not much at Hyper-V. I have preferred VMWare for my demo/research environments, especially as I move between Windows and OSX regularly. However I’ve thought Hyper-V was rapidly improving and on the right track. I was surprised to find the new limits in Hyper-V under Windows Server 2012 to be quite high for both the host OS and the guests. You can have up to

    • 64 virtual processors
    • 1TB RAM
    • 64TB (vhdx format)
    • 4 virtual Fibre Channel adapters
    • much more

    With 320 logical processors and 4TB of ram on the host, it seems as though Hyper-V is on par with VmWare ESX 5. There’s a lot more to look at than software cost, but at this time, it appears all new virtualization projects using Windows ought to consider Hyper-V.

    There were interesting demos on replicas, live migration, improvements in file transfers and more. They were designed to make things look good, and there’s a good marketing presentation on the capabilities. I’m sure the actual implementation isn’t as easy or smooth as in the talks, but it did make me think there’s no reason virtualization shouldn’t be considered for SQL Servers, especially as you move to newer hardware.

    Steve Jones


    The Voice of the DBA Podcasts

    We publish three versions of the podcast each day for you to enjoy.