Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

BCP vs. OPENDATASOURCE Expand / Collapse
Author
Message
Posted Sunday, December 28, 2008 1:15 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Yesterday @ 11:40 AM
Points: 6, Visits: 332
I’m researching some of the different methods of loading the data warehouse via T-SQL. I have some questions.

Which is most efficient/faster, and why?

A. BCP: On source system, export data to flat file. Then load into DW via BCP or Bulk Insert.
Overhead: query data, writing to a flat file, transferring over network, converting flat file data to data types, inserting into a table. DW is simple mode logging, therefore minimal logging is the same as BCP. Other overhead to consider?

B. Distributed Query: Import data from source system via OPENDATASOURCE, running a stored procedure on the source system to run a query to get the data. The data is then inserted in a table in the DW.
Overhead: query data, storing result set temporarily in tempdb, transferring over network, inserting into table. DW is simple mode logging, therefore minimal logging is the same as BCP. OPENDATASOURCE/sp does not allow for batch. To batch, multiple data requests will have to be made to the source system, which adds to overhead. Other overhead to consider?

Where are the large bottlenecks:
Write to flat file vs. write to tempdb?
Network transferring flat file vs. transferring dataset?
Batching flat file with BCP vs. batching multiple calls over OPENDATASOURCE to stored procedure?
Others?

Thank you.



Post #626329
Posted Sunday, December 28, 2008 2:31 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 5:41 PM
Points: 35,944, Visits: 30,229
SQL Server uses BCP to do replication... that should be the answer right there. And, if you use the NATIVE mode (like replication does), you don't have to worry about datatypes and all that.

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

"Change is inevitable. Change for the better is not." -- 04 August 2013
(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #626342
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse