Sunday, August 12, 2007

Travelogue: When at your wits' end have a shower! nIghT becomes day...

Soon I was busy chatting with my offshore team – it was 7am, I had woken up three hours earlier but was yet to brush my teeth or have my breakfast. Ah; the pains of being onsite – the pains of offshoring! I was discovering the downside of working from home; you think that you can work as you please but the reality was like Wreet said, “We end up working for a longer time when we work from home”. And to top it all your eating habits go for a toss – you have a late and hurried breakfast, you don’t have time to make lunch because you will be glued to the laptop screen, and till around 10/11 am the offshore team will be present online and you will spend most of the time discussing the project with them. When we are in offshore we think it is fun to work from home!

The restarted job ran for three hours but never completed; the database administrator came up with the idea or running some jobs on the database to ensure that database access is optimized. That meant pulling down the online regions for a while – it was 9am and the online users were active. But fortunately the lead for the online team was okay with bringing down the region for 10 minutes – he sent a note to all users to log out of the system immediately. Fortunately our online system wasn’t that critical to the business and we could afford a 10 minute halt in operations. Try, try, try again - we reran the same program but again it ran for another three hours without success.

It was now lunch time and there was only one option – skip that particular program and continue with the rest of the jobs (and hope that no other program gets stuck like this again). The rest of the programs completed quickly – much to my relief and the relief of the production support team. But we still had to rerun that particular program to generate the reports before the next end of day (EOD) jobs started. And that meant a gap of roughly four hours – 5pm the batch jobs would get triggered. I had to find the problem, fix it and generate the reports. Fortunately (looking back I think I have been fortunate on a number of things today), I didn’t have any other major tasks for the day and could concentrate fully on this problem. It was 12:30pm and I had just one bowl of cornflakes in the morning, was feeling a bit tired due to lack of sleep (for almost 5 days now), really hungry and had to solve a problem to which I didn’t have any clue in the last eight hours.

I wanted to get out somewhere to forget about everything for a while and relax; the weather wasn’t great with rains lashing the entire state. The only option left was to take a bath! It was one of the longest baths I’ve had – I stayed under the shower for around 40 minutes; felt refreshed and energized. I didn’t succeed in totally forgetting the problem but I felt much better mentally and physically.

With renewed enthusiasm I took a second look at the problem; I analyzed the database, analyzed the queries in the code and the bulb flashed in my head. There are times when you get into a flow where your mind just keeps coming up with ideas and suggestions one after the other; and invariably when in this mood you tend to crack the problem. “Eureka”! The index wasn’t used properly and the SQL query caused each and every record in the database to be read instead of limiting the search using the index. I tried some code snippets to confirm my theory and it was perfect. Now all I had to do was correct the code and get it rerun.

I completed everything with one hour to spare; after you solve the problem life definitely becomes a lot better!

And the moral of the story is “when you are at your wits end to solve a problem, relax and have a long shower”!

No comments: