更新时间:2023-01-15 19:28:41
没有
CTE 是一种临时的内联"视图 - 您不能向此类构造添加索引.
A CTE is a temporary, "inline" view - you cannot add an index to such a construct.
如果您需要索引,请使用 CTE 的 SELECT 创建一个常规视图,并使其成为索引视图(通过向视图添加聚集索引).您需要遵守此处列出的一组规则:创建索引视图.
If you need an index, create a regular view with the SELECT of your CTE, and make it an indexed view (by adding a clustered index to the view). You'll need to obey a set of rules outlined here: Creating an Indexed View.