Click here to Skip to main content
15,889,899 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have an SQL Database which has a column with the primary key "id" with data type BigInt

When I use the query to delete and insert things. it continues to increment the id number.

I am worried about if I insert and delete things 1000s of times, that it would eventually have the id number go off Bigint boundaries. Is this possible?

If it is possible I want to know if I could delete an item each time, it would move all the data/id number ahead of it to fill in the missing spot. Kind of similar to what you have to do to an array.
Posted

"I am worried about if I insert and delete things 1000s of times, that it would eventually have the id number go off Bigint boundaries. Is this possible?"

It certainly is - it'll take a while though - I'll be quite surprised if any of us is still around :)

Best regards
Espen Harlinn
 
Share this answer
 
A bigint is 8 bytes in size which means you will have a max value of 9,223,372,036,854,775,807. I think you'll be ok.
 
Share this answer
 
Bigint size is -2^63 through 2^63-1. You are quite far away to reach here. There is no worry about it.
 
Share this answer
 
To tell the truth, what you concern is not necessary to be thought. As Marcus Kramer puts it, the boundary is so large that you can ignore it.

But by the way, I want to ask you why do you worry about that ? Furthermore, what things do you want to do ?
 
Share this answer
 
Comments
Member 8015046 8-Jul-11 11:03am    
Well I know multiple machines use this server, each Posting of a message is id. And each of these machines does 100 thousands times. So I don't know how many times it would do it. I just want to make it fail proof =P

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900