SSIS 中查询内的Where子句与条件拆分内的Where子句之间的复杂性差异
我一直想知道,这两种情况之间的复杂性差异是什么:
情况 1:一个 OLE DB 源查询,写成这样:
select *
from A
where A.value > 1
情况 2:一个 OLE DB 源查询,并将 where 子句放在条件拆分
select * from A
中在 OLE DB Source 查询之后,包含: value > 1.
性能上有什么区别吗?对于更复杂的查询,它是否也有任何重大影响?
I've been wondering, what's the complexity difference between these two cases:
Case 1: An OLE DB Source query, written like this:
select *
from A
where A.value > 1
Case 2: An OLE DB Source query, and the where clause is put in Conditional Split
select * from A
with the Conditional Split after the OLE DB Source query, containing: value > 1.
Performance-wise, does it have any difference? And for more complex query, does it have any significant impact also?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,存在性能差异。
情况 2 将返回表 A 中的所有数据记录并将它们存储在 SSIS 内存缓冲区中,然后将它们传递到条件拆分组件进行过滤。
情况 1 立即将较小的数据集返回到 SSIS 内存缓冲区。
如需进一步阅读,请参阅:
Yes there is a performance difference.
Case 2 will return all data records from table A and store them in the SSIS memory buffer before passing them on to the Conditional Split Component for filtering.
Case 1 immediately returns a smaller data set to the SSIS memory buffer.
For further reading take a look at:
SSIS 的主要用途是与异构源(例如文本文件、Excel 电子表格等)导入/导出。您可以在将数据加载到服务器之前进行某种验证,并且可能会在某处记录“错误”记录。
但是,如果您计划仅将 SSIS 与 SQL 查询结合使用,并且在文本文件中不进行任何验证或错误日志记录,那么您应该寻找其他解决方案(链接服务器、OPENROWSET 等)。
但如果您仍在查看 SSIS,则应该在 SQL 查询或数据源中包含所有可能的逻辑。
有一篇关于如何使用 SSIS 准备快速提取的文章: http: //www.sqllion.com/2009/04/faster-extraction-loading-by-ssis/
Main purpose of SSIS is Import/Export with/from heterogeneous source (such as text files, Excel spreadsheets etc). You can make some kind of validation before you loading data to server and it is possible to log "wrong" records somewhere.
But if you plan to use SSIS with SQL query only and without any validation or error logging in text files, you should look for another solution (Linked server,OPENROWSET and some more).
But if you are still look at SSIS, you should include all possible logic inside SQL query or data source.
There is article about how to prepare fast extraction using SSIS: http://www.sqllion.com/2009/04/faster-extraction-loading-by-ssis/