在 SQL 2008 中为 TVP 创建索引
我们可以在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以拥有主键和唯一约束,它们将自动具有支持它们的索引,但您无法为 表类型
如果您认为您的查询可以从进一步的索引中受益,那么您必须将 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)