oracle中常用Hint

  • 动态采样
    /*+ dynamic_sampling(采样级别) */

  • 查看带有A-Time的执行计划
    /*+ gather_plan_statistics */

  • 全表扫描
    /*+ full(表名或别名) */

  • 索引范围扫描
    /*+ index(表名/别名 索引名) */

  • 索引跳跃扫描
    /*+ index_ss(表名/别名 索引名) */

  • 索引全扫描
    /*+ index(表名/别名 索引名) */

  • 索引快速全扫描
    /*+ index_ffs(表名/别名 索引名) */

  • 嵌套循环
    /*+ use_nl(表名1,表名2) leading(表名1) */

  • 哈希连接
    /*+ use_hash(表名1,表名2) leading(表名1) /
    外连接时,改变驱动表使用/
    + use_hash(表名1,表名2) swap_join_inputs(表名1) */

  • 排序合并连接
    /*+ use_merge(表名1,表名2) */

  • 指定from后面的表依次关联
    /*+ ordered */

  • 禁止笛卡尔连接
    /*+ opt_param(’_optimizer_mjc_enabled’,‘false’) */

  • 给子查询取别名
    /*+ qb_name(别名) */

  • 子查询产生filter
    /*+ no_unnest */

  • 禁止视图合并
    /*+ no_merge */

  • 谓词推入
    /*+ push_pred(视图名) */

  • 索引降序扫描
    /*+ index_desc(视图名) */

  • 并行查询
    /*+ parallel(number) */

  • 广播
    /*+ pq_distribute(驱动表 none,broadcast) */

  • 并行hash hash
    /*+ pq_distribute(b hash,hash) */

  • a为远端表,b为本地表,把b传输到远端
    /*+ driving_site(a) */

  • 固化子查询
    /*+ materialize */

  • hash anti join
    /*+ hash_aj */

  • hash semi join
    /*+ hash_sj */

  • 告诉CBO表的rows
    /*+ cardinality(表名 rows) */

Guess you like

Origin blog.csdn.net/csdnklsdm/article/details/119681315
Recommended