Hello SSC!
I have been tasked with optimizing a stored procedure the imports data from XML to SQL tables. This SP is executing many child stored procedures and is using dynamic SQL. So, as you can imagine, performance is awful. All of our data is imported through XML files and there are a lot of them. Below are the options that I found, but if someone has a better/quicker solution I would love to hear it. Of course, this needs to be done ASAP, so I am at least looking for a solution to get approved and then can implement this later.
Solution possibilities:
Any assistance would be greatly appreciated!
Dave
The are no problems, only solutions. --John Lennon
April 17, 2025 at 4:25 pm
Try google with these search terms sql shredding xml to tables
I haven't done this for quite some time, but that's how I found a performant method the last time I needed to do this
You can try the following approaches to optimize the stored procedure:
Optimize XML Parsing: Use FOR XML PATH or OPENXML for better XML parsing, or use SQL Server’s xml data type for efficiency.
Bulk Insert: Instead of row-by-row inserts, break XML files into chunks and use bulk insert for faster data loading.
SQLXML 4.0: This driver could improve XML handling without major changes to your procedure.
ZappySys: If the company approves the cost, this tool can help speed up the process with less effort, despite the learning curve.
Focus on optimizing XML parsing first, then consider SQLXML 4.0 or a tool like ZappySys for a more efficient solution.
April 21, 2025 at 8:47 pm
We are going to try SQLXML 4.0. It seems to be what we need. We have one master stored procedure that is calling 15 child procs that all have dynamic SQL. Querying the XML directly without DS should improve performance by a lot and all I will have to do is remove the ticks and adjust the variables... Small potatoes.
As always thank you all for your assistance, and I will update this ticket with my test results to help other users.
Have a great week!
Dave
The are no problems, only solutions. --John Lennon
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply