SQLServerCentral Editorial

What counts for a DBA: Foresight

Of all the valuable attributes of a DBA, from passion to humility to practicality, perhaps one of the most important attributes may turn out to be the most seemingly nebulous: foresight. According to Free Dictionary, foresight is the "perception of the significance and nature of events before they have occurred". Foresight does not come naturally to most people, as the parent of any teenager will attest. No matter how clearly you see their problems coming, they won't listen and have to fail before eventually (hopefully) learning for themselves.

Having graduated from the school of hard knocks, the DBA, a naïve teenager no longer, acquires the ability to foretell how events will unfold in response to certain actions or attitudes with the unerring accuracy of a doom-laden prophet. Like Simba in the Lion King, after a few blows to the head, we foretell that a sore head will be the inevitable consequence of a swing of Rafiki's stick, and we take evasive action. However, foresight is about more than simply learning when to duck. It's about taking the time to understand and prevent the habits that caused the stick to swing in the first place. And based on this definition, I often think there is a lot less foresight on display in my industry than there ought to be.

Most DBAs reading this editorial will spot a line such as the following in a piece of "working" code, understand immediately why it is less than optimum and take evasive action.

...WHERE CAST (columnName as int) = 1

However, the programmers who regularly write this sort of code clearly lack that foresight. This and numerous other examples of similarly malodorous code prevail throughout our industry (and provide premium-grade fertilizer for the healthy growth of many a consultant's bank account).

Sometimes, perhaps harried by impatient managers and painfully tight deadlines, everyone makes mistakes. Yes, I, too, occasionally write code that "works" but basically stinks. When the problems manifest, it is sometimes accompanied by a sense of grim recognition that somewhere in me existed the foresight to know that that approach would lead to this problem. However, in the headlong rush, warning signs got overlooked, lessons learned previously, which could supply the foresight to the current project, were lost and not applied.

Of course, the problem often is a simple lack of skills, training and knowledge in the relevant technology and/or business space. Programmers and DBAs are forced to do their best in the face of inadequate training or apply their skills in areas where they lack experience. However, often the problem goes deeper than this; I detect in some DBAs and programmers a certain laziness of attitude.

They veer from one project to the next, going with "whatever works", unwilling or unable to take the time to understand where their actions are leading them. Of course, the whole "Agile" mindset is often interpreted to favor flexibility and rapid production over aiming to get things right the first time. The faster you try to travel in the dark, frequently changing direction, the more important it is to have someone who has the foresight to know at least roughly where you are heading. This is doubly true for the data tier which, no matter how you try to deny it, simply cannot be "redone" every month as you learn aspects of the world you are trying to model that, with a little bit of foresight, you would have seen coming.

Sometimes, when as a DBA, you can glance briefly at 200 lines of working SQL code and know instinctively why it will cause problems, foresight can feel like magic, but it isn't; it's more like muscle memory. It is acquired as the consequence of good experience, useful communication with those around you, and a willingness to learn continually, through continued education as well as from failure. Foresight can be deployed only by finding time to understand how the lessons learned from other DBAs and other projects can help steer the current project in the right direction.

C.S. Lewis once said "The future is something which everyone reaches at the rate of sixty minutes an hour, whatever he does, whoever he is." It cannot be avoided; the quality of what you build now is going to affect you, and others at some point. Take the time to acquire foresight; it is a love letter to your future self saying you cared.