SSIS 不识别索引?

SSIS does not recognize Indexes?

我有一个 table,在 varchar 列上有一个非聚集索引 'A'。
当我使用 Order By A 子句时,我可以看到它扫描索引并在几秒钟内给我结果。
但是,当我对 'A' 列使用 SSIS 的 Sort Component 时,我可以看到对记录进行排序需要几分钟时间。


所以我明白它不能识别我的非聚集索引


有没有人知道为 SSIS 使用索引而不是使用查询而不是组件?

31 Days of SSIS – What The Sorts:

Whether there are one hundred rows or ten million rows – all of the rows have to be consumed by the Sort Transformation before it can return the first row. This potentially places all of the data for the data flow path in memory. And the potentially bit is because if there is enough data it will spill over out of memory.

In the image to the right you can see that until the ten million rows are all received that data after that point in the Data Flow cannot be processed.

This behavior should be expected if you consider what the transformation needs to do. Before the first row can be sent along, the last row needs to be checked to make sure that it is not the first row.

For small and narrow datasets, this is not an issue. But if you’re dataset are large or wide you can find performance issues with packages that have sorts within them. All of the data load and sorted in memory can be a serious performance hog

Order By A 在数据库中是 运行。

使用排序组件时,排序在 SSIS 运行时间内完成。请注意,您用来进行排序的查询中没有顺序(我假设)

它在 运行 时间内完成,因为它与数据源无关 - 您的源可以是 excel 或文本文件或内存数据集或多案例或数据透视表或任何东西。

我的建议是尽可能使用数据库。

在 SSIS 包中使用排序的唯一原因是您的源不支持排序(即平面文件)并且您想在包中对其他内容进行合并连接。这是一个非常罕见和特殊的案例

这些时候我研究和使用 SSIS 时,我发现使用索引的唯一方法是连接到数据库。但是,当您在流中获取数据时,您所拥有的只是记录和数据。没有索引!


所以对于像 Merge Join 这样需要 Sort component 的任务,我尝试使用 Lookup 组件而不是 完整缓存 选项.并缓存整个数据然后在 Source component 查询

中使用 ORDER BY