dbTalk Databases Forums  

Speed up insert

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Speed up insert in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
OM
 
Posts: n/a

Default Speed up insert - 02-28-2011 , 03:06 PM






Hi,

is there an option to increase the time of inserting 1M rows to a
table using stored procedure?

Already removed all the indexes and the database is on Raid 10/

Thanks

Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Speed up insert - 02-28-2011 , 08:55 PM






OM (oranmeir (AT) gmail (DOT) com) writes:
Quote:
is there an option to increase the time of inserting 1M rows to a
table using stored procedure?

Already removed all the indexes and the database is on Raid 10/
There are certainly several options. BULK INSERT or BCP is probably
the fastest. But you say "with a stored procedure". Where does the
data come from? How does your current solution look like? And which
version of SQL Server are you using?


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Reply With Quote
  #3  
Old   
omtechguy
 
Posts: n/a

Default Re: Speed up insert - 03-01-2011 , 09:17 AM



SQL 2005, The data comes from other tables on the same DB.

On 1 מרץ, 04:55, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote:
Quote:
OM (oranm... (AT) gmail (DOT) com) writes:
is there an option to increase the time of inserting 1M rows to a
table using stored procedure?

Already removed all the indexes and the database is on Raid 10/

There are certainly several options. BULK INSERT or BCP is probably
the fastest. But you say "with a stored procedure". Where does the
data come from? How does your current solution look like? And which
version of SQL Server are you using?

--
Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008:http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005:http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Reply With Quote
  #4  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Speed up insert - 03-01-2011 , 05:34 PM



omtechguy (omtechguy (AT) gmail (DOT) com) writes:
Quote:
SQL 2005, The data comes from other tables on the same DB.
Pity you are not on SQL 2008, since INSERT can be minimally logged on SQL
2008.

There are not really that many options, but it may help to do it in batches
of 10000, 50000 or 100000 rows. It is essential that if you batch, that you
select the batches so that the selection itself does not take too much
time.

But then again, maybe that is the problem? That is, it is not the insertion
that actually takes time, but it is the selection of it. Could you post an
example of your procedures?



--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.