Showing posts with label bcp. Show all posts
Showing posts with label bcp. Show all posts

Wednesday, March 28, 2012

optimizing bcp performance

I mistakenly posted this in the "programming" forum- reposting here as it
makes more sense to be in this forum...
We have a conversion process where we bcp out a table and then run a C++
program against it and then later bcp the data into a new table.
For a 24 Million row table, the bcp out takes about 83 minutes and the bcp
in takes about 87 minutes.
Is there any performance considerations to be aware of that could possibly
make this run faster (SQL 2000)? For example - I recall in SQL 6.5 that
there was a "select into/bulkcopy" option. Is there anything similar in SQL
2000?
For the bcp out, is there a way to reduce locking (maybe grab a table lock).
Any input would be appreciated.
Thanks in advanceyes,
Drop indexes on the table
change the database recovery mode to bulk logged ( In SQL Enterprise
Manager)
Do the bcp in (Use the TABLOCK hint)
Recreate the indexes
change back to full recovery
Do a transaction log backup..
You can also increase the load time by dividing the input file into multiple
files and firing off several concurrent BCPs. This is available when you use
the TABLOCK hint.
"TJTODD" <Thxomasx.Toddy@.Siemensx.com> wrote in message
news:#7Ac88OuDHA.2308@.TK2MSFTNGP09.phx.gbl...
> I mistakenly posted this in the "programming" forum- reposting here as it
> makes more sense to be in this forum...
> We have a conversion process where we bcp out a table and then run a C++
> program against it and then later bcp the data into a new table.
> For a 24 Million row table, the bcp out takes about 83 minutes and the bcp
> in takes about 87 minutes.
> Is there any performance considerations to be aware of that could possibly
> make this run faster (SQL 2000)? For example - I recall in SQL 6.5 that
> there was a "select into/bulkcopy" option. Is there anything similar in
SQL
> 2000?
> For the bcp out, is there a way to reduce locking (maybe grab a table
lock).
> Any input would be appreciated.
> Thanks in advance
>

Saturday, February 25, 2012

OPENXML vs BCP

Hi,
My application writes data into sql server.

Currently it converts data into XML (an in memory XML string) and write
using OPENXML.

I want to know if i write it to a csv file and use BCP, then will it be
faster then OPENXML. (i feel, writing to a csv will create IO operation that
will slow down the process).

ThanksIf you have many records, I would expect BCP to be much faster. The fastest
way to import large amounts of data into SQL Server is using a bulk insert
technique like BCP.

If your data originates as XML, you might also check out XML Bulk Load. See
http://msdn.microsoft.com/library/d...lkload_7pv0.asp

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Sandy" <a@.a.com> wrote in message news:dhr9v4$15v@.netnews.net.lucent.com...
> Hi,
> My application writes data into sql server.
> Currently it converts data into XML (an in memory XML string) and write
> using OPENXML.
> I want to know if i write it to a csv file and use BCP, then will it be
> faster then OPENXML. (i feel, writing to a csv will create IO operation
> that
> will slow down the process).
> Thanks