How to run a database: some ground rules

So you think you want to be a database engineer/architect/maintainer/worker? Notice, I didn’t say “DBA.” THis is mostly because I have met so many that are not….Database engineers and architects that are good at what they do get paid well, but the term “DBA” has little meaning because there are many people who have minimal understanding of SQL who claim that title. Don’t claim that title unless you are at least MCSE. For an entry level application/database engineer of a big platform sitting on SQL, the expectation is that your pay may deviate from those who work on the front end of the application.

Depending on the industry and the application, you may expect to get paid slightly more than the people on the front side.  This is because it is expected that you will have the same skills as them, but also have knowledge of infrastructure systems, and also be somewhat more willing to receive calls at strange times of day. For example, someone who has five years experience may get paid $77,000.  Someone with the exact same certifications and industry experience, but who can solve real problems and find and fix a root cause that has dropped the entire system to its knees, may get paid anywhere from $80k to $180k, with $80k being entry level into the database/infrastructure work.

Ok, enough about that.  Here are a few ground rules for good database etiquette:
  1. There are very few, select problems that  necessitate a reboot or restart of SQL server to fix a problem. Don’t do it if you don’t know why you’re doing it.
  2. Know your backup strategy, know that it works, and make sure management knows it, too.
  3. Know your disk IO, and test and retest and have a history of tests of it.
  4. Know what your users are doing and why they are doing it.
  5. Database queries should be fast.
  6. Understand the difference between poor disk I/O and poor file I/O
  7. There are a few blogs that are good, plus a lot of misinformation. Know which ones are best. (Ask around).
  8. Read a book, take notes, make lists, have checklists,blog about your experience.
  9. Never test code in a production environment. Especially never test UPDATE, DELETE, or INSERT SQL.
  10. Key lookups, table valued functions, table scans, and clustered index scans are red flags that a query is not well designed. Understand how to fix them PROPERLY.

That’s all I have on this subject, folks.  Let me know if you have any questions!

 

How to Quit a Bad Habit

Please pardon any typos. I do this entirely on my iPad, on the train.

The other day I had a conversation with someone about how he never gets anything done.  That sparked a mention of Parkinson’s Law, which reminded me of this essay I wrote quite some time ago….Now, mind you, I’m not an economist, or even that smart about money. I don’t really understand where money comes from, even though it’s been explained to me a hundred times by people smarter than me.

Last year I decided to delete my Facebook app from my iPad. It was a distraction, not because I couldn’t focus on the work I needed to do, but because it was intrusive. I would be typing an email, creating a calendar appointment, or simply browsing the web and there, at the top of the screen, a little thingy would roll over with my friend Douglas saying, “gotta go to the store! Outta beer” or Eric’s status update of, “checking in at the Recliner,” as though I know what “the Recliner” is, and would want to come right over if I did….so I removed it.  The app, not the Recliner.

“Wait, Scorellis!” you say, “Why not just change the settings?”  Because I don’t have time! I find my way around computers OK; it’s just that whenever I try to change anything about how Facebook works, it usually means going down one rabbit hole or another.

I decided that my desire to avoid the complexity of digging into my preferences to prevent the unwanted notifications was greater than my desire to keep facebook on my device.  And the pop-ups werre intolerable. Besides, Zuckerberg would just change my preferences later on without asking, and it would start to do something else equally annoying.  The dude has serious stalker-like issues.  Facebook is like some sort of super-app for stalkers, right?

Later, on my iPhone (which doesn’t constantly annoy me, not with pop-ins), as I struggled with wading through the timeline navigation, my aggravation levels slowly increased.  With its pretty graphics and immense page size, this timeline feature crushed the performance of my iPhone. I am teetering on the edge of deleting the app.  Then, (now. pay attention!) as I browsed facebook I suddenly read a post by a friend of mine.  Oh joy of commiseration! He bears similar anti-timeline angst!

“Aaaaargh! I’ve been timelined!” he posted.

I think about how to respond to him.  I experience a landslide of thoughts in my mind.

Mind-slide

I want to express my frustration in a single sentence, as direct and short as his, but I cannot find the words.   I want to suggest that we all delete the app from our devices. I am fairly certain that if we delete the app, the complexity of the task of finding it and reinstalling it will probably be an effective preventative against ever again using Facebook.

This would not be a terrible thing. I went 20 years without talking to most of these people, I can probably go another 20 and if, after reconnecting as we have, they want to maintain the relationship, there are other ways. I have a phone. Perhaps they could send me email messages..?

Or maybe I could make an RSS feed from my facebook newsfeed that filters the spam posts (really, nobody has done this yet?)…besides, 98% of the people that I became friends with never even say anything, they just lurk, like a bunch of creepers.

When I signed up for Facebook, I thought we’d have these amazing conversations, but most of my friends never say anything!  Recently, one of my friends from Facebook who I occasionally see in the physical realm made a comment that he knew something about me because he read it on fb. Deja vu.

Now, all of the wheels in my mind are spinning, like a juggler spinning plates; I wanted to compress this avalanche of thought and empathize with my friend in just a few poignant words. I want this whthin mind-slide of thought to crash.

“Congratulations,” I say sarcastically. “you’ve been timelined.”

But what does that mean?

How do I  calculate the tipping point, the point of no return, when something becomes such a pain in the ass that it becomes obvious I should not be doing it anymore? If i have a certain amount of time allotted to complete a task, then at what point will the expansion of the work by an outside force cause me to abandon the task.  Is it a return on investment (ROI) problem? Certainly the point of no return involves ROI, but clearly people invest time and money in things that have not clear ROI at all! I have more questions than answers now.  I don’t understand how to calculate the coefficient of nuisance. When, exactly, does something become so bothersome that I can no longer be bothered by it? My mind-slide completes, the wheels stop spinning, and I turn to the Internet for answers.

I Google It.

I got to thinking that there must be some inviolate law of economics which would explain my behavior, so I searched the phrase, “complexity of task is so great that people won’t be bothered to do it. They would rather suffer the consequences instead.”

This search yielded lots of hits on how to stop procrastinating, but one link caught my eye: “How to use Parkinson’s Law to Your Advantage.”

(OK, you can stop reading now.  Here is where it gets crazy.)

I had read about Parkinson’s law before, about the Coefficient of Inefficiency, but all my question are not answered. When does an increase in consumption due to an increase in efficiency become less a matter of paradox, and more a matter of poor decision making? For example, as automobiles become more fuel efficient, rather than being responsible and increasing gas mileage, what has Detroit done? They have increased horsepower and in many cases, gas mileage has gotten WORSE!

This is the Paradox, the absurd contradiction. The price of gas hits $5.00 a gallon, but still people can be bothered to buy cars, put gas in them, and do what they always do. They don’t mind the longer hours at work, lower wages, less savings, and more money, more money,  more money being thrown down the rabbit hole. The most exquisite paradox of all is that if everyone is raising prices, then nobody is raising prices! Except the first few people, who experienced a momentary, monetary gain!  Then there is the additional vector of manufacturing and consumers placing visceral pleasure over social responsibility. Is this Parkinson’s law, Jevon’s Pradox, or poor decision making?

Does the amount of pleasure derived from an act have something to do with all of this? (tongue in my cheek, we know it does).  Jevon’s Paradox states that with any increase in technical efficiency, there will be a corresponding increase in demand.  I would add that the demand will always outpace the efficiency.  It’s a paradox because one would expect that as efficiency increase, then the demand for raw materials would decrease.  For example, think of automobiles. Fuel efficiency has improved, yet the demand for gasoline continues to increase.

But is this really a paradox, or mightn’t it just be stupidity?

There must be a theoretical upper limit to how much horsepower an automobile needs, and perhaps there is a theoretical limit to the need for travel, but ultimately, according to my sources (the Internet), the only effective cap that will truly limit demand is cost. An increase in cost from either green incentives or simple taxes will decrease use. Expensive gas, taxed to hell, will, therefore, increase fuel efficiency?  Or will people just drive less?  I sense a conspiracy in all of this! The Internet is wrong, of course (well, actually, after this post it will be right again, won’t it?). If something is a serious, serious pain in the ass to do, people will also stop doing it.  For example, swimming in Lake Michigan is far less popular in February than in July, because there is a very large barrier to doing it. It’s f’ing cold.  You have to buy a thermally insulated, diving dry suit, or you have to be slightly nuts. Like I always say, you aren’t crazy until you start acting on your crazy thoughts.

There are a number of versions of Parkinson’s Law, such as: “Work Expands to fill the time available for its completion.”  Perhaps another would be that “the list of things to do always exceeds the amount of time we have to get it all done,” which naturally begets “if it’s important enough to get done, you’ll find the time to do it.”

My favorite version of Parkinson’s law is, “if you wait until the last minute, it only takes a minute to do.” or “if you want something to only take a minute to do, wait until the last minute to do it.” Recently, I wrote a few chapters for a book titled “Network and Computer Security Handbook.” As I approached the deadline, I found that my critical thinking skills improved. What does that mean? I cut, hacked, slashed, wrote and viewed the work with far, far greater decisiveness than I did three months ago when I still had all the time in the world to get it done. I wrote more pages of content in one week than I did in three months. Perhaps I also spent considerably more hours on it in the final few weeks than I probably did in the final three months.

There is another law, too, which relates to this one, called Wirth’s law.  It states that “software is getting slower more rapidly than hardware becomes faster.”  I don’t know what that means.  Maybe this was a 1995 thing.  At one time, I might have thought that this meant that innovations in programming were allowing programmers to perform and code tasks of far greater complexity than there exists computing power to accomplish.  Duh!  For example, “computer, tell me please what is the highest prime number that exists?”  just because I can ask a computer to do something doesn’t mean anything.  I don’t see why this Wirth guy gets a law, but heck, if he gets one then so do I, right? Here is the law of Scorellis:

“The amount of work that some humans will attempt to get their computers to perform will always exceed the capability of the infrastructure to successfully complete it.”

The ability of the software to accept user requests will usually exceed the capacity of the hardware to get it done. This is because people do not want to be told “no” by a machine.  The interface between humans and computers leans strongly towards one of a passive nature. Like watching TV, a user in Seattle of a website in Chicago has no notion of the 10,000 other users across the country hitting the machine at the same time. To her, it is just slow.

Essentially, people will always ask more of the subsystem than the subsystem is capable of delivering. No surprise there, right? We do the same things to ourselves and each other, too.  Software developers are people. ( I think. ) Some software developers are better than others, but computers have a funny affect on psychology.  If I ask a computer to do one thing, should’t it be able to do that one thing, even when I multiply it by a thousand times? And in the same amount of time? I once accidentally opened 20 photos on a PC.  So then I tried to open 200 photos; thinking that it would only take 10 times as long. Ha!  I was young once, too.

Somewhere in here there is a moral…if you want to quit a bad habit, it needs to be excessively cost prohibitive to do so from both a financial and efficiency perspective.  Hmmm. Maybe that could be called “the moral of Scorellis.”