Re: Bulk inserting into database using ADO.NET... deadly slow?
From: Chris Botha (chris_s_botha_at_AT_h.o.t.m.a.i.l.com)
Date: 05/01/04
- Next message: Huan Larsen: "Re: Transaction Commit TimeOut but Transaction still completes"
- Previous message: Roy Fine: "Re: Bulk inserting into database using ADO.NET... deadly slow?"
- In reply to: Massimo: "Bulk inserting into database using ADO.NET... deadly slow?"
- Next in thread: Pablo Castro [MS]: "Re: Bulk inserting into database using ADO.NET... deadly slow?"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 1 May 2004 10:09:45 -0400
There are not many options, I would have tried the following:
(1) In the app select less records at a shot, 50K for instance, where you
know it is still fast.
(2) Write the data to a file and call the "BULK INSERT" statement from your
program (look in your SQL Server documentation for "BULK INSERT").
Compare the speed of the two and decide which one to use.
"Massimo" <barone@mclink.it> wrote in message
news:OCrvPUyLEHA.3712@TK2MSFTNGP11.phx.gbl...
> I have this SQL Server 2000 database, which I want to populate with data
> generated from a program; the schema is quite simple (one table, seven
> columns, each one one byte wide), but there are plenty of data: about 450
> million rows, for an estimated total of ~3 GB.
> So, I wrote my data-generating .NET application, and then tried to put
data
> into a DataSet and then storing it into the DB using a SqlDataAdapter...
and
> it was painful. My first guess was to store as much data as possible into
> the DataSet, so to reduce the DB updates, but I found that when reaching
> about 100K rows the DataSet becomes slower and slower, each insertion
taking
> more time than the preceding ones. So i resorted to update the DB more
> often, and I tried doing it every 20000, every 10000 and every 5000 rows
> added, but it always seemed to take a lot of time (i.e. more than one
minute
> to insert 20K rows).
> Finally, I decided to avoid DataSets, and I simply wrote all of the
program
> output to a 6 GB CSV text file, and imported it into the DB using DTS;
and,
> wonderful... it started inserting 40-50K rows *per second*; after about
five
> hours the job was completed.
> So, here's the question: why is it so painfully slow to insert big chunks
of
> data into a DB using DataSets? It's so slow that even a 6 GB text file
> provides a *much* better throughput...
>
> Massimo
>
- Next message: Huan Larsen: "Re: Transaction Commit TimeOut but Transaction still completes"
- Previous message: Roy Fine: "Re: Bulk inserting into database using ADO.NET... deadly slow?"
- In reply to: Massimo: "Bulk inserting into database using ADO.NET... deadly slow?"
- Next in thread: Pablo Castro [MS]: "Re: Bulk inserting into database using ADO.NET... deadly slow?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|