Stupid Genius

- Making mistakes is our rights, learning from them is our responsibilty.

- "I have no choice" is another way of saying "I've have chosen the easier option"

- Genius is 99% perspiration and 1% inspiration - Thomas A Edison

My Photo
Location: Singapore

Tuesday, October 16, 2007

My friend was commenting on the way a certain application increment it's row IDs. They have 1 sequence generator to share among all the tables. He was commenting that this runs a danger of running out of numbers. There should be 1 sequence for each table.

I show him this:
Generators store and return 64-bit values in all versions of Firebird. This gives us a value range of:

-9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807

So if you use a generator with starting value 0 to feed a NUMERIC(18) or BIGINT column (both types represent 64-bit integers), and you would insert 1000 rows per second, it would take around 300 million years (!) before it rolls over. As it is pretty unlikely mankind will still walk on this planet by then (and still use Firebird databases), that's nothing to be really worried about.

So there. No worries about running out of numbers.

He acknowledge this. Then we saw that the application not only shares the sequence numbers, it jumps 100 when the server is restarted. He said that it's a waste of numbers. Again, I reminded him of the article. He still not feel comfortable about it. So I gave him this analogy:
You are not a rich man. You are used to getting the most for your money. You tried to get a good bargain for everything you buy. You evaluate if you really need it. You tried to look for cheaper alternatives.

Then you met a rich man. He never bargain. He doesn't look for cheap alternatives to what he want to buy. He just get what he want with no second thought. You know that the money spent is chicken feed to him. He can use his time looking for bargains in more "meaningful" stuff. But that will not stop you from feeling the "waste".


Subscribe to Post Comments [Atom]

Create a Link

Anonymous Rude visitor said...

It is the mindset of your friend that all of us should adopt or learn from. To never waste.

It is the rich man and people like you who are killing our planet. Buy and be done with it. Consume, consume, consume.

So go rot in h*ll!

10/18/2007 5:34 PM  
Blogger StupidGenius said...

ur comment doesn't sound very relevant. i say a rich man can buy things without bargaining and looking for alternatives. i never mention anything abt buying things and wasting it.

I only say that when a normal guy need to buy something, he will always try to bargain and look for places where it's sold cheaper. he will not understand why someone will spend double the amount for the exact same thing that he's getting.

Of course there are rich people who buy things that they don't need and just leave it to rot. This wasteful behavior I do not condone either.

10/22/2007 12:34 PM  

Post a Comment

<< Home