BOFH: SQL for Retards
Turning the Tables
BOFH 2002: Episode 4
So the bloody DBA's complaining about performance problems, which really gets on my tits, given that he's responsible for them in the first place...
"But you're the Systems Manager - you're responsible for performance," The Boss argues, no doubt having received training from DB central.
"I'm responsible for the SYSTEM performance, yes," I comment. "But I'm not responsible for the which of the volumes he puts his tablespace on."
"Uh?" The Boss responds, reverting to subhuman IQ as a defence.
"OK, an analogy. Let's say I was the building owner and I rent you 30 offices."
"And you have 30 staff."
"And you put them all in one office because then you won't have to go all around the floor to see what people are up to."
"And then you complain to me about the air-conditioning because that one office is stinking hot, humid and smelly."
"Ah, I get your point!"
"We could save on office rentals by packing people into offices, and I wouldn't have to walk around the building so much. But what about the Database problem? I've been told that it's affecting our Financials system quite badly.."
"I think you're missing the point. I have allocated GOBS of space on different disks for the DBA to put Tablespaces into, however, he puts them only into one - because it's TIDIER. So it bottlenecks accessing that disk!"
"But why would he do that?"
"Because he's had no formal training in the DBA role? Because he read 'SQL for Retards' and lied on his CV? Because no-one tested his ability before they gave him a small bag of cash and his own office? Because we appointed someone on the cheap?"
"I... Uh.. Well, it happened before I was here, so I don't know how I can help!"
"Fire him? Get a good person in? Pay them properly?"
"But they charge extortionate rates!"
"So do we, and we're worth it. As opposed to the cowboys you normally hire - who probably don't even do backups!"
"I'm sure he does backups!"
"Ones that can be recovered from?"
"I.. Well I.. .. Could you meet with him and talk with him about it?"
"I don't think we'll get very far. He's not a very nice bloke - quite... offensive really"
The Boss stops short of saying "that's rich coming from me" - but I know he's thinking it.
. . .
Later that day in DB Central, after five rounds of "I'm better than you because I can use the sqldba command..."
"..so why don't we move a couple of the heavier-used tablespaces to other disks." I coach, suppressing my annoyance and trying to give him a couple of hints. "Run a select across the filespace location tables - you'll see they're all on the same disk."
"I don't think you're really on the money there," the DBA smirks quietly. "SQL's a pretty complex language. It's not just SELECT A FROM B - often it's much more complex than that. You need to KNOW the database."
"RIGHT! Well why don't I just pop downstairs and get my SQL for Dummies, and I'll be right back."
"OK, if you want."
. . . 10 minutes and lots of >clickety< >clicks< later . . .
"I was thinking, we're using a Financials system based around our database aren't we?"
"Yes," the DBA responds.
"So you probably wouldn't do any SQL anyway would you - except for the odd DBA-type statement, if that."
"No, there's a lot of SQL needed in this role - Backups for instance, an.."
"But surely the backup script is static, and there would have been one in play here when you started?"
"Yes, but it needed modifications as it wasn't optimal."
"OK, anyway, so I wrote down a couple of SQL statements which I'd like you to do for me."
"Still trying to learn, eh?" he asks, not missing a chance to treat me condescendingly.
"Well, got to keep trying, no matter how pointless," I concur, eating humble pie.
"OK, fire away!"
"Could you go into the financials database and type SELECT N,Q,A FROM DBAQUESTIONS WHERE N=1"
"And that's one row which is '1', GUESS WHOSE DBA ACCOUNT JUST DROPPED THE GENERAL LEDGER TABLE' and 'YOURS'. Very odd. I don't even remember a table called DBAQUESTIONS?"
"I think it's fairly new," I respond. "Now, moving right along, SELECT N,Q,A FROM DBAQUESTIONS WHERE N=2."
"Which is '2', 'GUESS WHOSE BACKUP SCRIPT HAS A SYNTAX ERROR IN IT CAUSING IT TO BOMB OUT' and 'YOURS'. Are you sure this is a real table?"
"Quite sure. Now SELECT N,Q, etc WHERE N=3."
"'3', 'GUESS WHICH DBA HASN'T TAKEN A CONSISTENT BACKUP SINCE TWO DAYS AFTER HE STARTED' and 'YOU'..... This is one of your tables, isn't it?"
"SELECT 'YES' FROM YESTABLE WHERE YESCOLUMN = 'YES'."
"You won't get away with it."
"SELECT * FROM YESIWILLTABLE."
"Why do you keep talking like that," the DBA asks, getting a little disconcerted.
"I'm into the Zone," I respond, "I can't help myself! But now do that first SELECT again, with N=4."
"'4', 'GUESS WHO'LL BE FIRING YOU ONCE HE'S READ ALL THOSE EMAILS ABOUT HOW CRAP HE IS AS A BOSS' and 'THE BOSS'."
Our Soon-to-be-Ex-DBA rushes off to try and save his job, which is bloody annoying, truth be known, as he didn't get around to the fifth row - my favourite "'5','GUESS WHO LOOSENED THE HANDRAIL ON THE STAIRS AND OILED THE FLOOR', 'ME'."
I type in a quick "SELECT * FROM DBAQUESTIONS" to have one last look, only to find an additional row '6', 'GUESS WHO'S GOING TO RAT YOU OUT UNLESS HE GETS SUFFICIENT LAGERS TO NUMB HIS MEMORY' '?'"
I forsee a DROP TABLE that The PFY won't be expecting. At the pub. ®
- Tune in to http://www.salmondays.tv for a live-action comedy vid-strip, inspired by our beloved BOFH
- BOFH 2K+1: The whole shebang
- The Compleat BOFH Archives 95-99
BOFH is copyright © 1995-2002, Simon Travaglia. Don't mess with his rights.
Sponsored: Becoming a Pragmatic Security Leader