zoukankan      html  css  js  c++  java
  • SQL 游标总结和性能分析(1)

    Cursor Type

    Work On Table

    Rows retrieve

    Scrolling Type

    SQL Statement

    Fast?

    Read Only?

    Client?

    Server?

    Open Cost

    Fetche Cost

    Scroll Overhaed

    Impact Tempdb

    Concurrency

    Lock

    Forward-Only

    directly   On table

    Until   FETCH

    Only   FETCH NEXT

    FAST_FORWARD

    Fast

    Yes

    Yes

    Yes

    Low(not   tempdb)

     

    Low

    Low

    Low

     

    Static

    Snapshot in Tempdb

    After   open cursor

    All   scrolling options

    STATIC

    Faster

    Yes

    Yes

    YES

    Highest

    Lowest(create   in tempdb)

     

    Highest

     

    No   Lock

    Keyset-driven

    1.Controlled   by Keyset

    2.After   open cursor,create the keyset of row in the tempdb

    3.Limit   the membership

    1.First   look at the keyset of rows in tempdb.

    2.Navigate   to table to retrieve the data.

    All   scrolling options

    KEYSET

    Slowly

    No,all   changes

    NO

    Yes

    lower   open cost than the static cursor;

    Higher   open cost than forward-only and dynamic cursors

    Highest

     

    lower   impact than the static cursor;

    higher   than forward and dymamic cursor

     

    Higher   lock than the static cursor.

    Dynamic

    directly   On table

    Until   FETCH

    All   scrolling options,except BSOLUTE

    DYNAMIC

    Slowest

    No,all   changes

    NO

    Yes

    Low(not   tempdb) than static and keyset cursor

     

     

     

     

    Highest   Lock  

     

     

     

     

    Cursor Type

    Update?

    Lock?

    Fast?

    Read Only

    No

    No   Locks

    fastest

    Optimistic

    Yes

    No   Locks

    fast

    Scroll Locks

    Yes

    U Lock

    Slowest

  • 相关阅读:
    本学期的学习计划
    snmp 学习记录
    解锁树莓派root账号
    树莓派通过阿里云内网穿透,搭建下载机
    golang Ordered Map
    go 切片slice奇怪的地方
    学习scons总结
    go语言学习小结
    学习git版本管理工具
    轻松记账工程冲刺第二阶段10
  • 原文地址:https://www.cnblogs.com/andrewgao/p/2654025.html
Copyright © 2011-2022 走看看