并行合并... SQL Server会这样做吗? [英] Unioning in parallel... will SQL Server do it?

查看:85
本文介绍了并行合并... SQL Server会这样做吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我要合并位于不同驱动器上的多个表中的数据,SQL是否会并行提取数据?我应该了解任何相关设置或提示吗?

If I want to union data from multiple tables located on different drives, will SQL pull the data in parallel? Are there any related setting or hints I should know about?

推荐答案

至少从SQL Server 2005开始,UNION应该并行运行.

The UNION should run in parallel, at least since SQL Server 2005.

如果表位于不同的驱动器或相同的驱动器上,这没有什么区别.在现代世界中,磁盘可以是虚拟的,也可以具有多个读取头.一个驱动器和一个以上驱动器之间的区别越来越不重要.

It doesn't make a difference if the tables are located on different drives or the same drive. In the modern world, disk can be virtual, or have multiple read heads. The distinction between one drive and more than one drive is less and less relevant.

如果将MAXD​​OP设置为1,则只有一个线程.

If you have MAXDOP set to 1, then there will only be one thread.

请注意,UNION将比UNION ALL慢得多.

Do note that UNION is going to be much slower than UNION ALL.

布兰登. . .让我在这里回应.您似乎在考虑较旧的样式体系结构.这些肯定仍然存在.但是,现代磁盘具有多个读取头和多个磁盘.通常,返回数据的问题涉及控制器级别的带宽,而不是读取速度.您还具有多个缓存和预读级别(有时在文件系统和数据库级别).通常最好让数据库引擎来管理这种复杂性.

Brandon . . . let me respond here. You seem to be thinking in terms of older style architectures. These definitely still exist. However, modern disks have multiple read heads and multiple platters. Often, the issue with returning data involves the bandwidth at the controller level, and not the speed of the read. You also have multiple levels of caching and read-ahead (sometimes at both the file system and database levels). You are often better off letting the data base engines manage this complexity.

例如,我现在正在使用的计算机实际上是一台虚拟机.我使用的磁盘是EMC盒上的分区.处理器是一个大盒子中的一组处理器.

For instance, the machine that I'm working on right now is really a virtual machine. The disk I use is a partition on an EMC box. The processors are some set of processors in a big box.

这篇关于并行合并... SQL Server会这样做吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆