Thursday, March 3, 2011

My wife and SQL cursor

It is incredible amount of luggage my wife forced us to take with us on three weeks vacation. It was problem moving it around and we actually did not use half of it. When we came home at eight in the morning we were already tired and nervous. It was time our neighbors go to work and it happened that a new neighbor came with truck a half an hour ago and started moving furniture to his flat on the second floor. There are two floors and basement on our building with three flats on each floor. Our flat is on the first floor. Can you imagine my joy with perspective of carrying that entire luggage to the first floor from garage, bumping into all neighbors either carrying furniture or hurrying to work? 

When I took the biggest suitcase the discussion started and it was quickly escalated to yelling. Yes, I took the heaviest suitcase, but only one instead of all at once. 

My wife hates taking one piece at time because:
a) It will take much more time then carrying all at once.
b) She is irritated with prospect going up and down so many times and waiting for furniture people in the process.
c) Her legs were swollen and again she did not want to go up and down so many times.

I did not want to carry all at once because:
  a) I was simply not strong enough and my back would be hurt if I even tried. 
  b) I would block all my neighbors in the process. 
  c) Neighbors going to work were already frustrated with the time new neighbor started moving furniture. 

Finally my wife concluded that she did not mean that I should carry everything by myself. Her idea was that she would also take as much as she can and our small son too. However, it was still unrealistic to take everything in one turn. We agreed that everyone will take as much as possible without hurting back.I had to go up and down three times with the heaviest luggage, but it was optimal approach IMO.

When we finally finished, I started talking about row by row processing, data set approach, processing huge volume of data in batches and incorporating multiple process to do the job in parallel. My wife thought I got crazy, but I hope you got the idea what I was talking about. So, in the next post(s) I will discuss these approaches, advantages, drawbacks and when it is good idea to apply them.


  1. Nice idea to narrate a situation :) Keep it up Mirko :)


  2. Thanks, Hemant :)

    You know I have always tried to encourage novices in sql that it is not rocket science, you just have to apply common sense.