且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SQL Server不使用XML索引来查询XML行集

更新时间:2022-06-07 22:28:00

我理解原帖有点模糊但是时间有点稀疏,所以现在要澄清一些更多的信息.​​..

I understand the original post is a bit vague but time was a bit sparse so some more information to clarify now...

XML数据的数量可能很大(每个记录平均约15K记录集)数百万)可能有一些TB大小的dbs(大多数只有几百GB,所以它们更容易管理)。

There is a potentially large(ist) amount of XML data (about 15K average per record wth recordsets in the millions) in potentially some dbs of TB size each (most are smaller at only a few hundred GB so they are more managable).

它采用了所有的单核CPU(由于SQL用于解析它的较低级别的进程,XML在SQL引擎中处理单核)因此,任何解析XML信息都将永远无法在其上投入更多核心(我们使用的是现代3GHz + VM这个位的服务器场。)

It is taking all of single core CPU (XML is processed single core in the SQL engine due to the lower level processes SQL uses for parsing it) so any parsing of the XML information is taking forever with no avenue to throw more cores at it (we are using a modern 3GHz+ VM server farm for this bit).

为了加快报告速度,我在客户端上为他们希望报告的400多个XML字段属性添加了一个索引视图,用于数据挖掘, index是从备份构建的(他们不希望实时数据库发生更改或拥有任何内容低位插入或有任何复制它或实际上是等等,所以索引视图是从备份构建的。

To speed up reporting I added an indexed view for the client on over 400 XML field attributes they wish to report off for data mining, this index is built from a backup (they do not wish the live database to change or have anything that slows inserts or have anything replicating off it or indeed HA etc. on live so the Indexed view is built from a backup).

XML格式不可更改所以数据保存在属性(行集格式字段/数据)中阻止SQL使用任何类型的XML索引(我知道XML索引是过去经验中的cr @ p所以我抓着吸管)。

The XML format is not changable so the data being held in attributes (rowset format field/data) is stopping SQL from using any type of XML index (I know XML indexes are cr@p from past experience so I was clutching at straws).

我希望至少有一些方法可以让它使用Primary索引,因此碎片开销较小但无济于事。选择性索引也失败了。从我自己的跟踪来看,很明显,对于这种格式的XML,我们坚持使用XML数据上的索引视图的单个核心构建。

I was hoping there was at least some way to get it to use the Primary index so the shred overhead was less but to no avail. Selective indexes fail also. From tracing this myself it has become apparent that with XML in this format we are stuck with a single core build for Indexed Views on the XML data.

我可以用C#编写多线程预粉碎机来获得速度和核心用途,但希望SQL有一个我错过的可行答案。

I can code a multi-threaded pre-shredder in C# to get the speed and the core use but was hoping SQL had a workable answer I had missed.

感谢您花时间去寻找无论如何的人。

Thanks for taking the time to look anyhow folks.