Is SQLXMLBulkLoad4Class performance competitive for large file importing

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
According to http://msdn.microsoft.com/en-us/library/ms171721.aspx -- "You can insert XML data into a SQL Server database by using an INSERT statement and the OPENXML function; however, the Bulk Load utility provides better performance when you need
to insert large amounts of XML data." I thought "SQLXML Bulkload 4.0 Type Library" was a component to use for fast importing large xml file.
I have created 10 tables with auto increase primary keys and foreign keys in SQL Server database and used the following codes to shred a 390 MB file into those tables without any transformation. It took me around an hour. What a disappointment!
Flatting this file into an in-memory table and importing it with SqlBulkCopy only took me around 6 minutes.
Did anyone experience this? Is SQLXMLBulkLoad4Class simply just so slow or is it misused by me?

Thanks,

SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class objBL = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class();<br/>
objBL.ConnectionString = conn;<br/>
objBL.ErrorLogFile = "error.xml";<br/>
objBL.KeepIdentity = false;<br/>
objBL.CheckConstraints = false;<br/>
objBL.XMLFragment = true;<br/>
objBL.BulkLoad = true;<br/>
objBL.ForceTableLock = true;<br/>
objBL.Execute(xsd, xml);

View the full article
 
Back
Top