简体   繁体   English

SQL Server目标与OLE DB目标

[英]SQL Server Destination vs OLE DB Destination

I was using OLE Db destination for Bulk import of multiple Flat Files. 我正在使用OLE Db目标批量导入多个平面文件。 After some tuning I ended up with SQL Server Destination to be 25 - 50 % faster. 经过一些调整之后,我最终将SQL Server Destination的速度提高了25%-50%。

Though I am confused about this destination as there are contradictory information on the web, some are against it, some are suggesting using it. 尽管我对这个目的地感到困惑,因为网络上存在矛盾的信息,但有人反对它,有人建议使用它。 I would like to know, are there any serious pitfalls before I deploy it to production? 我想知道,在将其部署到生产之前是否有任何严重的陷阱? Thanks 谢谢

In this answer, I will try to provide information from official documentation of SSIS and I will mention my personal experience with SQL Server destination. 在此答案中,我将尝试提供SSIS官方文档中的信息,并提及我在SQL Server目标方面的个人经验。

1. SQL Server Destination 1. SQL Server目标

According to the official SQL Server Destination documentation : 根据官方的SQL Server目标文档

The SQL Server destination connects to a local SQL Server database and bulk loads data into SQL Server tables and views. SQL Server目标连接到本地SQL Server数据库,并将数据批量加载到SQL Server表和视图中。 You cannot use the SQL Server destination in packages that access a SQL Server database on a remote server. 您不能在访问远程服务器上的SQL Server数据库的程序包中使用SQL Server目标。 Instead, the packages should use the OLE DB destination. 而是,程序包应使用OLE DB目标。

The SQL Server destination offers the same high-speed insertion of data into SQL Server that the Bulk Insert task provides; SQL Server目标提供了与批量插入任务所提供的向SQL Server相同的高速数据插入。 however, by using the SQL Server destination, a package can apply transformations to column data before the data is loaded into SQL Server. 但是,通过使用SQL Server目标,程序包可以在将数据加载到SQL Server之前将转换应用于列数据。

For loading data into SQL Server, you should consider using the SQL Server destination instead of the OLE DB destination 要将数据加载到SQL Server中,应考虑使用SQL Server目标而不是OLE DB目标

2. OLEDB Destination 2. OLEDB目的地

According to the official OLEDB Destination documentation : 根据OLEDB Destination官方文档

OLEDB Destination - fast load option: Load data into a table or view in the OLE DB destination and use the fast load option, which are optimized for bulk inserts OLEDB目标-快速加载选项:将数据加载到OLE DB目标中的表或视图中,并使用快速加载选项,该选项针对批量插入进行了优化

3. OLEDB Destination vs SQL Server Destination 3. OLEDB目标与SQL Server目标

According to SQL Server Destination Vs OLE DB Destination - MSDN topic : 根据SQL Server目标与OLE DB目标-MSDN主题

Donald Farmer, the former Group Program Manager for Integration Services said that you can get a 5 to 10% increase in performance using the SQL Server Destination . 前集成服务部门计划经理唐纳德·法默(Donald Farmer)说,使用SQL Server Destination可以使性能提高5%到10%。

In addition, refering to the following post of Matt Masson a data integration specialist at Microsoft where he answered the following question: 此外,请参考Microsoft数据集成专家Matt Masson的以下帖子,他在其中回答了以下问题:

Should I use the SQL Server Destination? 我应该使用SQL Server目标吗?

The Answer was 答案是

No 没有

... ...

My recommendation is that if you need every bit of performance (a 10% perf increase on a 10 hour load can be significant), try out the SQL Server Destination to see how it works for you. 我的建议是,如果您需要性能的每一点(在10个小时的负载下性能提高10%可能非常重要),请尝试使用SQL Server Destination来查看它如何为您工作。 However – keep in mind the following limitations of the SQL Server Destination: 但是,请记住SQL Server目标的以下限制:

  • You must have SSIS running on the same machine as the destination database 您必须将SSIS与目标数据库运行在同一台计算机上
  • You must run the package as an administrator 您必须以管理员身份运行软件包
  • It is very difficult to debug when things go wrong 出现问题时很难调试

Given these limitations, I recommend using the OLE DB Destination even if you are seeing a performance increase with the SQL Server Destination. 考虑到这些限制,即使您发现SQL Server Destination的性能有所提高, 我还是建议使用OLE DB Destination。

3.1. 3.1。 The Data Loading Performance Guide 数据加载性能指南

(Update @ 2019-03-25) (更新@ 2019-03-25)

While searching on SSIS best practices i found a very helpful Microsoft artcile that can be used as a reference: 在搜索SSIS最佳实践时,我发现了一个非常有用的Microsoft文章,可以用作参考:

In this article they made a comparison between all data loads methods including SQL Server destination and OLEDB destination, they mentioned that: 在本文中,他们对所有数据加载方法(包括SQL Server目标和OLEDB目标)进行了比较,他们提到:

SQL Server Destination The SQL Server destination is the fastest way to bulk load data from an Integration Services data flow to SQL Server. SQL Server目标 SQL Server目标是将数据从Integration Services数据流批量加载到SQL Server的最快方法。 This destination supports all the bulk load options of SQL Server – except ROWS_PER_BATCH. 此目标支持SQL Server的所有大容量加载选项-ROWS_PER_BATCH除外。

Be aware that this destination requires shared memory connections to SQL Server. 请注意,此目标需要与SQL Server的共享内存连接。 This means that it can only be used when Integration Services is running on the same physical computer as SQL Server. 这意味着它只能在Integration Services与SQL Server在同一台物理计算机上运行时使用。

OLE DB Destination: The OLE DB destination supports all of the bulk load options for SQL Server. OLE DB目标: OLE DB目标支持SQL Server的所有批量加载选项。 However, to support ordered bulk load, some additional configuration is required. 但是,为了支持有序的大容量加载,需要一些其他配置。 For more information, see “Sorted Input Data”. 有关更多信息,请参见“排序的输入数据”。 To use the bulk API, you have to configure this destination for “fast load”. 要使用批量API,您必须将此目标配置为“快速加载”。

The OLE DB destination can use both TCP/IP and named pipes connections to SQL Server. OLE DB目标可以同时使用TCP / IP和到SQL Server的命名管道连接。 This means that the OLE DB destination, unlike the SQL Server destination, can be run on a computer other than the bulk load target. 这意味着OLE DB目标与SQL Server目标不同,可以在除批量加载目标以外的其他计算机上运行。 Because Integration Services packages that use the OLE DB destination do not need to run on the SQL Server computer itself, you can scale out the ETL flow with workhorse servers. 因为使用OLE DB目标的Integration Services程序包不需要在SQL Server计算机本身上运行,所以可以使用主力服务器扩展ETL流。

3.2. 3.2。 Personal experience 个人经验

(Update @ 2019-03-25) (更新@ 2019-03-25)

Since this question is used as a reference by many, and after being more experienced in this domain, i added this section to mention my personal experience using SQL Server destination. 由于此问题已被许多人用作参考,并且在该领域经验丰富之后,我添加了本节以提及我在使用SQL Server目标服务器方面的个人经验。

While official documentation mentioned that SQL Server destination will increase performance, i don't recommend at all using this components due to many reasons: 尽管官方文档提到SQL Server目标将提高性能,但由于许多原因,我不建议使用此组件:

  1. It requires that destination server and the ETL server are the same (works only with Local SQL server) 它要求目标服务器和ETL服务器相同(仅适用于本地SQL服务器)
  2. It always throw exception that don't have any meaning 它总是抛出没有任何意义的异常
  3. After testing on huge volume of data the performance difference with OLEDB destination is negligible (tested on about 500 GB data loaded in chunks and the time difference is less than one minute) 在对大量数据进行测试之后,与OLEDB目标的性能差异可以忽略不计(对大约500 GB的数据块进行加载测试,时间差异小于一分钟)

You can also refer to the following post (from @billinkc) to get more information about this topic: 您还可以参考以下帖子(来自@billinkc)以获取有关此主题的更多信息:


4. Conclusion 4。结论

Based on Microsoft articles, you can say that SQL Server Destination increase the performance of inserting data (it uses BULK insert) , but it is designed for a specific case which is the Local SQL server. 根据Microsoft的文章,您可以说SQL Server Destination提高插入数据的性能(它使用BULK插入) ,但是它是针对特定情况(即本地SQL服务器而设计的。 OLEDB Destination is more general and recommended in the other cases and by using the Fast Load data access mode (which uses also BULK insert) on the OLE DB destination it will increase the performance of data load. OLEDB Destination是更通用的,在其他情况下建议使用,通过在OLE DB destination上使用Fast Load数据访问模式(也使用大容量插入) ,它将提高数据加载的性能。

On the other hand, based on my experience and from many articles written by SSIS experts, it is not recommended at all to use SQL Server Destination since it is not stable and it often throws exception and the performance can be considered as negligible. 另一方面,根据我的经验以及SSIS专家撰写的许多文章, 完全不建议使用SQL Server Destination,因为它不稳定且经常引发异常并且性能可以忽略不计。


Additional Information 附加信息

Recently, I published a detailed article about this topic. 最近,我发表了有关该主题的详细文章。 You can check it at: 您可以在以下位置检查它:

To augment Hadi's fine answer, don't use the SQL Server Destination. 为了扩大Hadi的答案,请不要使用SQL Server目标。

In my experience, the performance benefit does not outweigh the restriction that the package must be executed on the same machine as the destination database. 以我的经验,性能上的好处并没有超过必须与目标数据库在同一台计算机上执行程序包的限制。 It forces a processing architecture that may or may not be right for you today or a year from now. 它会强制使用一种可能在今天或一年后不适合您的处理体系结构。 It's just too inflexible for my tastes. 就我的口味而言,这太僵硬了。

The other, bigger reason I advocate avoiding the SQL Server Destination is the flat out bugginess I've experienced with it. 我提倡避免使用SQL Server Destination的另一个更大的原因是我在使用SQL Server Destination时遇到了麻烦。 Same flat file to an empty table- round 1, it aborts with a vague error message (can't recall specific) that something went wrong. 与空表第1轮相同的平面文件,它因出现错误而含糊不清的错误消息(无法回忆起)中止。 Immediately restart the package and it works as expected. 立即重新启动该程序包,它将按预期工作。 Maybe you, most humble reader, can accept that trade off in processing time for the reprocessing time but for me, it's not been worth it since probably 2008. 也许您(大多数不起眼的读者)可以接受在处理时间上进行折衷以换取处理时间,但是对我来说,自2008年以来这并不值得。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM