Patterns and Potential Problems

I saw a post recently from a developer that needed to refactor and rename a table in a live system. The post describes a pattern for doing so and gives the steps taken, though not the actual code. I like the pattern overall, and I think it can work well in many situations. It’s for a PostgreSQL table, so I don’t know what restrictions might be different from SQL Server, but this type of pattern can work for SQL Server as well.

It also could be problematic. Using the famous “it depends”, there could be issues with this pattern, depending on your workload and how your application is structured. The triggers in use could also be an issue in some environments, as they create an additional load.

The biggest concern I have with this pattern is the copying of the data. Likely this is something that always works on a developer’s machine with a few dozen or even hundreds of rows of data. If this is millions, or tens of millions, the copy could end up taking substantial time. There is also the issue of changing data, with data being added or changed in the table, separately from being copied out. Depending on your locking and concurrency schemes, you could miss data.

Or you could just lock the table and cause issues for clients. Both things that might not show up in developer testing. The lesson here is that changes to big tables need to be tested in a big way.

This isn’t to say the pattern is bad, but that you should be aware of the potential pitfalls and then develop mitigation strategies. One way to get around the data issue might be choosing a way of copying over new or changed data after the initial data movement, or maybe even a cleanup load later after the new table is online. There are many possible ways to mitigate issues, if you take some time to think about the potential issues and then come up with a solution.

When we are looking to make changes to our system, patterns are important to help us and others adopt the processes that work well. As we find and develop patterns, we need to ensure that we understand the strengths and weaknesses, and choose what’s best for us, with mitigation strategies to get around the potential problems. There often isn’t a perfect solution, and ensuring you and your team understand the limits of your chosen approach, helps ensure that we deploy code that not only works, but is deployed without causing issues.

Steve Jones

Listen to the podcast at Libsyn, Stitcher, Spotify, or iTunes.

Posted in Editorial | Tagged , | Comments Off on Patterns and Potential Problems

Daily Coping 8 Sep 2021

I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag.

Today’s tip is to let go of self-criticism and speak kindly to yourself.

This is hard. Being critical and unsatisfied with how I do things have driven me to work hard and focus. It’s something that I think has been important for my success.

However. I am working to be realistic in criticism and not “beat” myself up or chastise myself. I’m learning to better accept the choices I make, listen to my mind and body, and accept the choices I make. Often, my self-criticism is something related to a choice or priority, and I need to evaluate it as such.

I’m also human and flawed. I make mistakes, I offend people, I snap at my wife and kids, and I certainly let emotions take hold of me at times. I’m working to accept mistakes, think about if I’d do something differently, recognize when something isn’t the priority I wish it were, and then move forward.

Try to stay positive, accountable for mistakes, but working to improve the future, not dwell on the past.

Posted in Blog | Tagged , , | Comments Off on Daily Coping 8 Sep 2021

Daily Coping 7 Sep 2021

I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag.

Today’s tip is to notice the things you do well, however small.

I do often try to do a good job, even if it’s not quick or easy. Lately, around the house I’ve been working to cook different meals, which the family has enjoyed. I’ve also had to do some maintenance on engines, which is simple, but I try to do a good job and managed to avoid spilling oil around as I changed it from a couple ranch vehicles.

I’ve been keeping on top of scheduling various items at work, trying to get ahead of my deadlines, and make it easier for others that are waiting on me.

I also managed to set my out of office for all of my recent absences, both for email and slack. That’s not something I’ve typically been good at, so I’m proud that I’m getting better.

Posted in Blog | Tagged , , | Comments Off on Daily Coping 7 Sep 2021

Live Your Life

Summer is coming to an end. For many of you with kids in school, it’s likely already over.  The first Monday in September in the US is Labor Day, and that’s often when I’ve marked the end of summer. Hopefully you had the chance to get a break from life, the pandemic, and work with some vacation this summer.

I’ve tried to work hard, be successful in my chosen career, and at the same time enjoy my life. That means time for me and my family away from work. It also means meeting responsibilities that I have, which include taking care of my home and animals. In other words, chores. All of this adds up to a lot of time necessary to accomplish my various goals, needs, and desires.

There are plenty of things, both in life and work, that I might put off for a period of time, expecting to find a block of time to handle them later. I think this is a common idea that I see friends, family, and plenty of others doing, optimistically viewing the future as one where more time will appear.

It might, but likely it won’t unless your life changes a lot. To me, that means that I need to find time today, make choices, delay some things, but tackle others, both responsibilities and desires, mixing them to create the life that I want. I was reminded of this again while watching this Abel Wang interview. It’s one of the last of his life, as Abel finally passed after a battle with cancer this summer.

He chose what was important to him, which is great. He also chose to live his life, not waiting for a distant future time. While most of us might expect we have years to live, you never know if that period of time might be much shorter than you expect. That mysterious future where you can finally visit that place, spend time with someone, accomplish a task, or anything else might not materialize.

I used to take stock of my life every year on my birthday. Was I doing the work I wanted? Are there things I wish I’d done the last year? Am I happy with life if I died today? That last one was a big one, and for years, I’ve felt I would be happy with how I’ve spent my time. These days my wife and I are getting older, and we evaluate the things we want to do on a shorter time frame, setting goals, making plans, and trying to ensure that we are really enjoying life every few months.

That doesn’t mean we’re always playing. We do have some busy work times, but we work to remember that we can’t let life get away from us for more than a few weeks before we need to ensure we’re balancing out the things we are obligated to do and the things we want to do. Finding balance has been helpful to ensuring that we can cope with stress, while not letting it overrun all aspects of our lives.

Steve Jones

Listen to the podcast at Libsyn, Stitcher, Spotify, or iTunes.

Posted in Editorial | Comments Off on Live Your Life