views:

71

answers:

1

I have a table with an XML column. The documents are pretty large and numerous, and I've been trying various ways to improve the performance of basic queries.

Because the documentation indicates that applying an XML Schema to the column can help SQL Server to optimize queries — and because one was available — I created a schema collection and applied the type to my XML column.

Query performance went off a cliff.

I mean, the very simplest tests became intolerably slow. I removed the column type, the queries performed just as well as before. Has this happened to anyone else?

I should note that the schema itself is rather large and elaborate. Still, this result seems counter-intuitive to me.

EDIT: My concern is with SELECT statements only -- in fact, these documents will never be edited, only browsed. So I can't see why the schema would be needed for anything besides possible optimizations, once the records have been inserted and validated.

Also, I'm aware of this issue, where an index on an XML column can adversely affect performance. That's not my problem — an index has had no noticeable impact, positive or negative, on the queries I'm running, and I have tried the above scenario with and without the index.

A: 

I think you've got your answer right there:

I should note that the schema itself is rather large and elaborate

A complicated schema can be computationally intense. If you're doing much in the way of updates especially, the schema has to be validated multiple times.

Charlie Martin