You are here: Re: Re: Inserting large amounts of data « MsSQL Server « IT news, forums, messages
Re: Re: Inserting large amounts of data

Posted by Erland Sommarskog on 09/09/05 00:29

oshanahan (UseLinkToEmail@dbForumz.com) writes:
> I'm using DTS to populate a staging table with raw streams of data (a
> lot of it) from one source. I thought about imbedding the SQL
> somewhere in the VB script that DTS uses. Our resident DTS man said
> he didn't think that was possible here.
> The problem essentially is that a large field on the staging table
> must be substringed to populate other tables, which have no
> relationship to the staging table. The substringing is where the
> performance drag is, but there is no way around that. I'm looking to
> somehow shave a little time on each populate transaction to help cut
> down processing.

Had you been on SQL 2005, you could have written an user-defined
function in C# of VB to decode this large field. It is not unlikely
that that would be faster than SQL builtins.

Using cursor to load handle one by one is definitely not a good idea.
What sometimes can be a good idea is to do, say, 10000 at a time. Batching
can be achieved with SET ROWCOUNT or TOP, but also be achieved by using
ranges in the source data. Important here is that the selection of a
batch follows a clustered index, or else the selection itself will kill it.

But this is more of interest if you get problems with the transaction
log. When the problem is with decoding a field, I don't think batching
is going to help you much. Do you need to have the data in the table
when you substring the field? Can't you substring the field before you
load it into the database? Doing the substringing in T-SQL is not the
most optimal for performance.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация