在 SQL 2008 中为 TVP 创建索引

发布于 2024-10-11 12:35:06 字数 85 浏览 7 评论 0原文

我们可以在 SQL Server 2008 中为 TVP(表值参数)创建索引吗?

请任何人给出语法。

提前致谢.. 维奈·K

Can we create an Index for TVP's(Table valued Parameters) in SQL Server 2008.

please can any one give the syntax.

Thanks In advance..
Vinay K

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

久随 2024-10-18 12:35:06

您可以拥有主键和唯一约束,它们将自动具有支持它们的索引,但您无法为 表类型


如果您认为您的查询可以从进一步的索引中受益,那么您必须将 TVP 中的行复制到临时表中(不是表变量),您可以在其上定义所需的任何索引。但显然这会增加一些额外的开销(时间和内存成本)

You can have primary key and unique constraints, which will automatically have indexes backing them, but you're unable to declare any indexes explicitly for table types


If you think your query could benefit from further indexes, pretty well you'll have to copy the rows from your TVP into a temporary table (not table variable), on which you can define any indexes you want. But obviously that will add some additional overhead (in time and memory costs)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文