Unix Technical Forum

Fact Table load - drop pk ?

This is a discussion on Fact Table load - drop pk ? within the SQL Server Data Warehousing forums, part of the Microsoft SQL Server category; --> I want to increase performance on a fact table load. The table has only a pk defined on an ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server Data Warehousing

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 05:06 PM
Phil
 
Posts: n/a
Default Fact Table load - drop pk ?

I want to increase performance on a fact table load.
The table has only a pk defined on an identity column.

Since it would help performance to drop all indexes
and then load a fact table. Is there anyway I can drop
the clustered index that is automatically created
on the identity column and then recreate it.

Would this help performance is the bottom line.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 05:06 PM
Kevin
 
Posts: n/a
Default Re: Fact Table load - drop pk ?

Inserting into an empty heap table is generally the fastest You'll need to
write a "post load" routine to add the indexes back in -

the approach I find most robust and high performance is as follows:

drop NC indexes
drop clustered index
load the data using a bulk api (bcp, bulk-insert, DTS bulk, etc)
create the clustered index
defrag clustered index <-- non intuitive, but optimal in many cases
create the PK (if PK is not clustered)
create other constraints
create the NC indexes
create statistics
dbcc updateusage

Before automating all this you'll obviously need to record the existing
indexes, constraints and statistics

----------------------------------------------------
The views expressed here are my own
and not of my employer.
----------------------------------------------------
"Phil" <atec396@hotmail.com> wrote in message
news:03ab01c3554f$3b3767d0$a401280a@phx.gbl...
> I want to increase performance on a fact table load.
> The table has only a pk defined on an identity column.
>
> Since it would help performance to drop all indexes
> and then load a fact table. Is there anyway I can drop
> the clustered index that is automatically created
> on the identity column and then recreate it.
>
> Would this help performance is the bottom line.



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 05:06 PM
Kevin
 
Posts: n/a
Default Re: Fact Table load - drop pk ?

you mean insert in order by clustered index order, right? (PK not
necessarily clustered...)


--
----------------------------------------------------
The views expressed here are my own
and not of my employer.
----------------------------------------------------
"Ray Higdon" <rayhigdon@higdonconsulting.com> wrote in message
news:eo6EBEXVDHA.1280@tk2msftngp13.phx.gbl...
> If you have a CL index on the primary key, it will improve performance
> to import new data with an "order by primary key" statement.
>
> HTH
>
> Ray Higdon MCSE, MCDBA, CCNA
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-27-2008, 05:06 PM
Kevin
 
Posts: n/a
Default Re: Fact Table load - drop pk ?

correction, first step should be drop constraints, and create constraints
and PK should be "WITH CHECK"
--
----------------------------------------------------
The views expressed here are my own
and not of my employer.
----------------------------------------------------
"Kevin" <ReplyTo@Newsgroups.only> wrote in message
news:#xA#VreVDHA.2032@TK2MSFTNGP11.phx.gbl...
> Inserting into an empty heap table is generally the fastest You'll need

to
> write a "post load" routine to add the indexes back in -
>
> the approach I find most robust and high performance is as follows:
>
> drop NC indexes
> drop clustered index
> load the data using a bulk api (bcp, bulk-insert, DTS bulk, etc)
> create the clustered index
> defrag clustered index <-- non intuitive, but optimal in many cases
> create the PK (if PK is not clustered)
> create other constraints
> create the NC indexes
> create statistics
> dbcc updateusage
>
> Before automating all this you'll obviously need to record the existing
> indexes, constraints and statistics
>
> ----------------------------------------------------
> The views expressed here are my own
> and not of my employer.
> ----------------------------------------------------
> "Phil" <atec396@hotmail.com> wrote in message
> news:03ab01c3554f$3b3767d0$a401280a@phx.gbl...
> > I want to increase performance on a fact table load.
> > The table has only a pk defined on an identity column.
> >
> > Since it would help performance to drop all indexes
> > and then load a fact table. Is there anyway I can drop
> > the clustered index that is automatically created
> > on the identity column and then recreate it.
> >
> > Would this help performance is the bottom line.

>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-27-2008, 05:06 PM
Ray Higdon
 
Posts: n/a
Default Re: Fact Table load - drop pk ?

Yes an EMPTY heap is fastest, and I did mean by order of the clustered
index if you retain the clustered index, it is definately good idea to
drop any NCI's and possibly CLI's before data load and then recreate
them after the load, this will ensure the lowest amount of fragmentation
and is better option than leaving them and then reindexing.


Ray Higdon MCSE, MCDBA, CCNA

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:58 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com