Sudheer Kumar

ASP.Net, C#, BizTalk, MSBuild, WPF, WCF, WF....
posts - 28, comments - 111, trackbacks - 16

My Links

News



Archives

Post Categories

FOR XML Performance with SQL 2005

We had a requirement to generate some extract data in the form of XML.
So while designing the solution, I had 2 options.
1. Use FOR XML in the Query with SQL 2005
2. Use regular SQL Queries and usign a Custom DataSet, serialize the data to XML.

SQL 2005 has nice options to get the XML.
You can assign name spaces to nodes, can have nested XMLs, can have custom Root and Child Xml node names.
One example can be found here.
http://www.wrox.com/WileyCDA/Section/id-301088.html

But FOR XML queries are much slower when getting huge amounts of data.
You can find a comparison here.
http://searchsqlserver.techtarget.com/tip/0,289483,sid87_gci1265579,00.html

So the bottom line is, FORXML is suitable only for small output.
Else do the logic in the business components.
And in most of the circumstances, the load on the database need to be kept low.
Hence second method was found the more suitable one.

Print | posted on Monday, January 07, 2008 12:10 PM | Filed Under [ SQL/XML SQL 2005 ]

Feedback

Gravatar

# re: FOR XML Performance with SQL 2005

The forxml also generates a fragment. I used it against 1 million rows on a conversion program. It took 1/2 hour. Good post.
1/7/2008 2:34 PM | Ken
Gravatar

# re: FOR XML Performance with SQL 2005

Who can advise something about web development? It is a new issue for me and I want to be in the know as soon as possible.
3/25/2011 3:45 AM | web development
Gravatar

# re: FOR XML Performance with SQL 2005

Good job.
3/31/2011 3:52 AM | led watch
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: