Is there any way to speed up Primary key creation on a
table
I have a 60o million row table and its taking forever
I know that data in table ic clean in data in PK columns i
am ccreating is unique
alter table Profile_table add primary key (as_of_date,
PAN11_ACCOUNT_NUMBER, PRODUCT_CODE)In addition to Brian's replay try to avoid using EM in such cases.
Go to QA and there do a creation.
"Brian Moran" <brian@.solidqualitylearning.com> wrote in message
news:e6q6sGbcDHA.1368@.TK2MSFTNGP11.phx.gbl...
> by default... a Primary Key is a clustered index. So the question is reall
> the same as 'how can I make a clustered index creation go faster'.
> You might find more info if you're searching on index creation...
> * what sort of hardware are you running on? SQL will take good advantage
of
> SMP, lots of memory, and fast disk for creating a large index like this...
> * there's no way to avoid the unique check if that's one thing you're
> wondering about. Doesn't matter if you KNOW that the data is unique... SQL
> will still check it...
> * take a look at the BOL entry for Create Index to make sure you
understand
> some of the basics around what happens if you have other indexes on the
> table already...
> also, I noticed that your key has a column in it that implies it's a
> datetime. Is that true? You should know that a PK has to be unique and
that
> the datetime datatype is only accurate to +-3MS. Therefore... SQL Server
> treats the datetime of '2003-01-01 00:00:00.000' as being identical to
> '2002-12-31 23:59:59.999'. This can create problems if you have a date as
> part of a PK...
>
> declare @.date1 datetime
> ,@.date2 datetime
> set @.date1 = '2003-01-01 00:00:00.000'
> set @.date2 = '2002-12-31 23:59:59.999'
> if @.date1 = @.date2 print 'the dates match'
> --
> Brian Moran
> Principal Mentor
> Solid Quality Learning
> SQL Server MVP
> http://www.solidqualitylearning.com
>
> "sanjay" <sanjayg@.hotmail.com> wrote in message
> news:059e01c371aa$1054d580$a301280a@.phx.gbl...
> > Is there any way to speed up Primary key creation on a
> > table
> > I have a 60o million row table and its taking forever
> >
> > I know that data in table ic clean in data in PK columns i
> > am ccreating is unique
> >
> > alter table Profile_table add primary key (as_of_date,
> > PAN11_ACCOUNT_NUMBER, PRODUCT_CODE)
> >
> >
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment