Thursday, February 4, 2010

The Unknown Table

  I'm a new employee at a software company where I was asked to take a look at our production DB schema and suggest possible avenues for optimization.  They said that it would probably be useful to have a "fresh pair of eyes" looking there for anything they have missed.



  I checked with all of the other devs who had been there for a few years about this mystery table and was told to check the DB Schema documentation.  There was no reference to Table X, of course.  I told them it was a mystery and no one could seem to remember what it did (if anything).  Upon looking into it more closely, the table was found to have over 6 million rows containing sequential numbers.  This was taking up a good bit of space, so a decision was made to delete it.

WHOOPS!

  Deleting it crashed the application.  Nobody could log in at all.  And, of course, restoring the table fixed the problem.  We spent a week or so looking through the application code to find any references to Table X and there were none.  Another week was spent trying to diagnose the crashing problem at the DB level and that's where we found it...  Apparently, an intern from the community college had mistakenly used our production DB to learn SQL instead of doing it on the dev DB (about a year before I showed up).  He had written a update trigger on the login auditing table to insert a new integer into table X.  It only took an hour to fix the problem once found, but, it certainly taught us a lesson.

You pay for unpaid interns: one way or another.


{submitted by DW}

0 comments:

Post a Comment