RE: Fixed Length file to Database perfomance issues
From: Alex (Alex_at_discussions.microsoft.com)
Date: 03/15/05
- Next message: Fred Hirschfeld: "Re: Fixed Length file to Database perfomance issues"
- Previous message: Jon Skeet [C# MVP]: "Re: Use switch with singleton objects"
- In reply to: Alex: "Fixed Length file to Database perfomance issues"
- Next in thread: Fred Hirschfeld: "Re: Fixed Length file to Database perfomance issues"
- Reply: Fred Hirschfeld: "Re: Fixed Length file to Database perfomance issues"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 15 Mar 2005 13:15:04 -0800
Just in case I'll get some kind of response, I have an update to my
code/issues:
I've eliminated some bottlenecks by calculating the start position and
length of each field and storing them in a hashtable before populating the
command object's parameters instead of doing this each time I looped, thus
it's only doing it once because those values will always be the same since
it's a fixed length text file.
This got the speed down to 30 seconds for the same 204 rows, which is much
better than the previous result, but still not enough if I'll be dealing with
several hundred thousands of rows.
Any help will be greatly appreciated!!!
"Alex" wrote:
> Hi! I'm trying to read a fixed length text file, get the information for each
> field from an XML file that describes the length of each sequential field,
> and them put them in SQL database. Here's what I'm doing thus far:
>
> 1) Generate a new command object with same name parameters as defined in XML
> (they directly match the names of parameters expected by the stored proc I'm
> using for inserts)
> 2) Read text file one line at a time
> 3) Pass that string to a function that populates the command object's
> parameter values with actual values parsed out of this line using
> string.Substring method
> 4) perform the command.executenonquery for the insert.
>
> The performance is pretty horrible this way, it takes about 2 minutes 34
> seconds for 204 rows with 52 columns.
>
> I'm open to suggestions as to how I can get this data quicker into the
> database. Either by using, BCP, or structs or some other method, but
> generally I need some kind of suggestion.
>
> Thanks in adance!
>
- Next message: Fred Hirschfeld: "Re: Fixed Length file to Database perfomance issues"
- Previous message: Jon Skeet [C# MVP]: "Re: Use switch with singleton objects"
- In reply to: Alex: "Fixed Length file to Database perfomance issues"
- Next in thread: Fred Hirschfeld: "Re: Fixed Length file to Database perfomance issues"
- Reply: Fred Hirschfeld: "Re: Fixed Length file to Database perfomance issues"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|