SSIS 查找转换是否仅缓存相关列?
Do SSIS lookup transformations cache only relevant columns?
我的完整缓存查找似乎导致失败。它是通过Lookup配置中的下拉列表直接指向查找table,我的理解相当于一个SELECT *。我认为通过更改查找配置以使用来自 SQL 语句的结果,在该语句中我仅选择了查找值和 return 值,它会减少缓存大小。但是,在进行此更改后,我发现缓存大小没有减少。这是因为 Lookup 足够智能,可以仅缓存配置的列部分中指定的列,而不是整个 table?
你是正确的,在下拉列表中选择 table 相当于 SELECT * 针对 table,因此查找将缓存所有数据,无论列使用。
为了提高性能,我总是建议人们编写一个自定义查询,提取所需的列,并在适当的时候过滤检索到的行的深度。
但是,你的问题让我开始真正寻找。这些结果基于 SQL Server 2017
我构建了 4 个包。基本模式使用 Adventureworks2014DW 的 FactInternetSales 作为驱动程序(OLE DB 源),以查找与 CustomerKey
匹配的 DimCustomer
操作 5 - 默认 table 选择。未检索到任何列 - 仅已链接
操作 6 - 连接的自定义查询 SELECT DC.CustomerKey FROM dbo.DimCustomer AS DC
操作 7 - 连接过滤器的自定义查询 SELECT DC.CustomerKey FROM dbo.DimCustomer AS DC WHERE EXISTS (SELECT * FROM [dbo].[FactInternetSales] AS FIS WHERE FIS.CustomerKey = DC.CustomerKey )
操作 9 - 复制第一个包,这次从客户维度中选择所有属性,减去键。这些是结果
我在详细日志记录下部署了 Integration Services 目录和 运行。我使用这样的查询来检索信息指标
SELECT
OM.operation_id
, OM.message
FROM
SSISDB.catalog.operation_messages AS OM
WHERE
OM.message like 'Data flow task:inform%lookup%'
AND OM.operation_id > 4
ORDER BY
OM.operation_id
, OM.message_time;
以下是我的结果。
operation_id message
5 Data Flow Task:Information: Lookup has cached 8192 rows.
5 Data Flow Task:Information: Lookup has cached a total of 18484 rows.
5 Data Flow Task:Information: The Lookup processed 18484 rows in the cache. The processing time was 0.062 seconds. The cache used 739360 bytes of memory.
6 Data Flow Task:Information: Lookup has cached 8192 rows.
6 Data Flow Task:Information: Lookup has cached a total of 18484 rows.
6 Data Flow Task:Information: The Lookup processed 18484 rows in the cache. The processing time was 0.109 seconds. The cache used 739360 bytes of memory.
7 Data Flow Task:Information: Lookup has cached 8192 rows.
7 Data Flow Task:Information: Lookup has cached a total of 18484 rows.
7 Data Flow Task:Information: The Lookup processed 18484 rows in the cache. The processing time was 0.14 seconds. The cache used 739360 bytes of memory.
9 Data Flow Task:Information: Lookup has cached 980 rows.
9 Data Flow Task:Information: Lookup has cached a total of 18484 rows.
9 Data Flow Task:Information: The Lookup processed 18484 rows in the cache. The processing time was 0.281 seconds. The cache used 38502172 bytes of memory.
总结
正如我们所见,令我震惊的是,一定有一些 optimization/pushdown 返回到源系统,因为缓存大小在前 3 运行 秒是相同的。只有当我使用查找的结果时,缓存才会增加。
我想说我会启动我的 VM 并针对 2005 年到 2016 年测试这种行为,但没有人有时间这样做。如果这种效率在 2012 年之前存在,我会感到惊讶。
我的完整缓存查找似乎导致失败。它是通过Lookup配置中的下拉列表直接指向查找table,我的理解相当于一个SELECT *。我认为通过更改查找配置以使用来自 SQL 语句的结果,在该语句中我仅选择了查找值和 return 值,它会减少缓存大小。但是,在进行此更改后,我发现缓存大小没有减少。这是因为 Lookup 足够智能,可以仅缓存配置的列部分中指定的列,而不是整个 table?
你是正确的,在下拉列表中选择 table 相当于 SELECT * 针对 table,因此查找将缓存所有数据,无论列使用。
为了提高性能,我总是建议人们编写一个自定义查询,提取所需的列,并在适当的时候过滤检索到的行的深度。
但是,你的问题让我开始真正寻找。这些结果基于 SQL Server 2017
我构建了 4 个包。基本模式使用 Adventureworks2014DW 的 FactInternetSales 作为驱动程序(OLE DB 源),以查找与 CustomerKey
匹配的 DimCustomer操作 5 - 默认 table 选择。未检索到任何列 - 仅已链接
操作 6 - 连接的自定义查询 SELECT DC.CustomerKey FROM dbo.DimCustomer AS DC
操作 7 - 连接过滤器的自定义查询 SELECT DC.CustomerKey FROM dbo.DimCustomer AS DC WHERE EXISTS (SELECT * FROM [dbo].[FactInternetSales] AS FIS WHERE FIS.CustomerKey = DC.CustomerKey )
操作 9 - 复制第一个包,这次从客户维度中选择所有属性,减去键。这些是结果
我在详细日志记录下部署了 Integration Services 目录和 运行。我使用这样的查询来检索信息指标
SELECT
OM.operation_id
, OM.message
FROM
SSISDB.catalog.operation_messages AS OM
WHERE
OM.message like 'Data flow task:inform%lookup%'
AND OM.operation_id > 4
ORDER BY
OM.operation_id
, OM.message_time;
以下是我的结果。
operation_id message
5 Data Flow Task:Information: Lookup has cached 8192 rows.
5 Data Flow Task:Information: Lookup has cached a total of 18484 rows.
5 Data Flow Task:Information: The Lookup processed 18484 rows in the cache. The processing time was 0.062 seconds. The cache used 739360 bytes of memory.
6 Data Flow Task:Information: Lookup has cached 8192 rows.
6 Data Flow Task:Information: Lookup has cached a total of 18484 rows.
6 Data Flow Task:Information: The Lookup processed 18484 rows in the cache. The processing time was 0.109 seconds. The cache used 739360 bytes of memory.
7 Data Flow Task:Information: Lookup has cached 8192 rows.
7 Data Flow Task:Information: Lookup has cached a total of 18484 rows.
7 Data Flow Task:Information: The Lookup processed 18484 rows in the cache. The processing time was 0.14 seconds. The cache used 739360 bytes of memory.
9 Data Flow Task:Information: Lookup has cached 980 rows.
9 Data Flow Task:Information: Lookup has cached a total of 18484 rows.
9 Data Flow Task:Information: The Lookup processed 18484 rows in the cache. The processing time was 0.281 seconds. The cache used 38502172 bytes of memory.
总结
正如我们所见,令我震惊的是,一定有一些 optimization/pushdown 返回到源系统,因为缓存大小在前 3 运行 秒是相同的。只有当我使用查找的结果时,缓存才会增加。
我想说我会启动我的 VM 并针对 2005 年到 2016 年测试这种行为,但没有人有时间这样做。如果这种效率在 2012 年之前存在,我会感到惊讶。