zoukankan      html  css  js  c++  java
  • 给DB数据表加强制索引

    • DB2 数据库会根据DB层的统计值决定 根据查询条件走哪一个索引,某些情况下,由于未知原因,索引会走偏,故程序中可以规定程序走哪一个索引来避免索引走偏的情况发生。

     强制走索引的 实例代码如下:

     1 SELECT vbeln
     2       zorgdn
     3       vstel
     4       zstaff
     5       zvtweg
     6       vsbed zacty
     7       zlifsk  erdat lfdat AS zdtday zebeln
     8    INTO CORRESPONDING FIELDS OF TABLE it_likp
     9    FROM likp
    10    WHERE    vbeln IN s_vbeln
    11    AND erdat IN s_erdat
    12    AND lfart = 'ZCRE'
    13    AND vstel IN r_vstel
    14    AND zebeln IN s_zebeln
    15    AND zorgdn = space
    16   AND lfdat IN s_zpldat
    17 %_HINTS DB6 '<IXSCAN TABLE=''LIKP'' SAP_INDEX=''Z06'' />'. "#EC CI_HINTS
    18 
    19 %_hints db6 '&SUBSTITUTE LITERALS&'.                      "#EC CI_HINTS
    20 
    21 where    vbeln in s_vbeln
    22                and erdat in s_erdat
    23                and lfart = 'ZCRE'
    24                and vstel in r_vstel
    25                and zebeln in s_zebeln
    26                and zorgdn = space
    27               and lfdat in s_zpldat
    28 * %_HINTS DB6 '&max_blocking_factor 5&' "#EC CI_HINTS
    29 %_hints db6 '&SUBSTITUTE LITERALS&'.
  • 相关阅读:
    Flutter 常用组件
    Chrome扩展应用
    Git操作指南
    ispriter自动构建css-sprite
    Sublime text2插件
    几个实用的sublime text 2的快捷键
    javascript数据类型转换
    requireJs压缩合并路径问题
    机器学习集成学习原理
    sklearn实现决策树算法
  • 原文地址:https://www.cnblogs.com/ruingy/p/4833324.html
Copyright © 2011-2022 走看看