Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 when BIGINT is not enough

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2009-07-15 : 09:10:07

Are there any options besides using a GUID ?

to give a brief summary of my needs, its just for a logging table (think having IIS style logs in a sql table)

I know this is pretty general, but any general help is much appreciated. How come we can't have an integer column bigger than BIGINT ? Or can we ? :D

thanks!
mike123

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-07-15 : 09:37:58
A BIGINT should be enough. As default, it start by 1,
but you can have it to start by -9,223,372,036,854,775,808.

A BIGINT should be enough. Even if you insert 1,000,000 records per second, you will have to run for 291,672 years before the numbers run out.


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2009-07-15 : 10:49:34
I assume you are talking about an identity column being used for a surrogate key.

As Peter mentioned, you are very unlikely to run out of identity values for a BIGINT in a real world system.

However, if you can really find a need for one, you can use a NUMERIC(38,0) identity column which will hold more possible values than UNIQUIEIDENTIFIER.






CODO ERGO SUM
Go to Top of Page

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2009-07-15 : 10:50:14
Hey Peso,

Wow that puts it into a good perspective, my calculation previously was way off ..

I agree and think BIGINT is enough too !

thanks yet again!
mike123
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-07-15 : 16:13:55
Maybe INT is enough too?

You can insert 1 record per second for 136 years, or 10 records per second for 13.6 years.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2009-07-15 : 19:04:26
one gotcha, when you join tables and one column is int and the other is bigint, SQL Server will try to convert the entire table that has int into bigint before joining.. so beware of that..I found this the hardway...

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2009-07-15 : 19:05:02
that was in 2000 btw.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2009-07-15 : 19:49:38
you'll run out of disk long before running out of bigints.


elsasoft.org
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-07-15 : 20:07:08
Isn't that what the Azure cloud is all about?
You don't have to worry about those little things.


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2009-07-16 : 00:49:24
do they have 100 exabyte storage? neat!


elsasoft.org
Go to Top of Page
   

- Advertisement -