Re: XML performance extremely slow for no obvious reason
- From: Dr Pizza <DrPizza@xxxxxxxxxxxxxxxxx>
- Date: Sun, 04 Mar 2007 19:24:01 +0000
On Sun, 04 Mar 2007 14:11:18 -0500, Steve Kass <skass@xxxxxxxx> wrote:
Thanks for the followup. This level of integration of XML into SQL Server
is new, and one hopes the folks at Microsoft will make progress so it's
more useful. As for the problem you're solving, XML may not be the
ideal solution because of some of these problems. While SQL Server
doesn't "have arrays," it sort of does, if you use a string as an array.
Now that the (max) types are available, it's even easier if the "arrays"
are long.
For an thorough treatment of the subject of arrays and SQL Server,
and examples of alternatives you may find faster, read Erland Sommarskog's
article here, which he literally just finished updating for SQL Server 2005
yesterday!
http://www.sommarskog.se/arrays-in-sql-2005.html
Yeah, it looks like XML is probably our best bet in this situation.
I guess it's not XML as such that's the problem, just the query optimizer
being stupid.
Given the three ways of writing the query:
subselect
temp table
XML
The first way is always slow (always creates millions of rows internally).
The second way is always fast (so far, at least).
The last way is fast when there are a few conditions, but slow if there
are lots of conditions.
And the last way can be made to always go fast, if you add "option
(recompile)" to the end of the query.
I'm pretty sure the query compiler/optimizer is actually doing something
wrong here, but using the temp table works, so we can go with that.
.
- References:
- XML performance extremely slow for no obvious reason
- From: Dr Pizza
- Re: XML performance extremely slow for no obvious reason
- From: Steve Kass
- Re: XML performance extremely slow for no obvious reason
- From: Dr Pizza
- Re: XML performance extremely slow for no obvious reason
- From: Dr Pizza
- Re: XML performance extremely slow for no obvious reason
- From: Steve Kass
- XML performance extremely slow for no obvious reason
- Prev by Date: Re: XML performance extremely slow for no obvious reason
- Next by Date: Re: Communicate XML between SP's
- Previous by thread: Re: XML performance extremely slow for no obvious reason
- Next by thread: Re: Communicate XML between SP's
- Index(es):
Relevant Pages
|