使用FAST_FORWARD定义游标的优点是什么? [英] What is the advantage of using FAST_FORWARD for defining a cursor?

查看:2187
本文介绍了使用FAST_FORWARD定义游标的优点是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用FAST_FORWARD定义游标的优点是什么?它是否更好的性能?为什么?

What is the advantage of using FAST_FORWARD for defining a cursor? Is it better for performance? why?

推荐答案

MSDN 是:


指定FORWARD_ONLY,READ_ONLY
光标已启用性能优化
。如果SCROLL或FOR_UPDATE也指定了
,则不能指定FAST_FORWARD
。 FAST_FORWARD和
FORWARD_ONLY是互斥的;

Specifies a FORWARD_ONLY, READ_ONLY cursor with performance optimizations enabled. FAST_FORWARD cannot be specified if SCROLL or FOR_UPDATE is also specified. FAST_FORWARD and FORWARD_ONLY are mutually exclusive; if one is specified the other cannot be specified.

我已经加粗了关键位。
如果指定了另一个不能
指定。它可以支持这些性能优化,因为它不需要支持通过游标的多方向迭代(FORWARD_ONLY),并且不支持修改(READ_ONLY)。

I've boldened the key bit. It can support these "performance optimisations" because it does not need to support multi-direction iterating through the cursor (FORWARD_ONLY) and does not support modifications (READ_ONLY).

当然,如果你真的不需要使用光标在所有 - 然后使用光标,即使使用这个选项也不会执行。如果你可以使用基于集合的方法做同样的任务,这样做 - 这是我真的想强调的。

Of course, if you don't really need to use a cursor at all - then using a cursor even with this option is not going to perform as well . If you can do the same task using a set-based approach, do that instead - this is the bit I really wanted to stress.

这篇关于使用FAST_FORWARD定义游标的优点是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆