首页 > 数据库 >oracle 禁用和强制直接路径读

oracle 禁用和强制直接路径读

时间:2023-05-11 17:13:19浏览次数:46  
标签:statistics read 禁用 路径 direct SQL oracle path table

How To Force Direct Path Read for SQL Statements (Doc ID 2426051.1)
There are ways to disable direct path read for SQL statements as follows:

1. event 10949 level 1
2. _serial_direct_read = NEVER

However, there are no direct methods to force the direct path read operations which are faster for some SQL statements.

Sometimes, the same SQL that used to run in direct path read suddenly changed to conventional cache reads causing slow performance.

Goal of this document is to provide a method to force direct path read for such SQL statements.

禁用的方式

强制

There are 2 methods to force direct path reads for SQL statements.

1. Use PARALLEL hint to the SQL statements like, /*+ parallel(4) */ so that parallelism uses direct path read.
2. Setting the statistics of the tables involved in the SQL such that the no.of blocks of tables > _small_table_threshold to enable the serial direct path read.

(i) Check the value of _small_table_threshold parameter in your DB.
SQL> select nam.ksppinm NAME,val.KSPPSTVL VALUE from x$ksppi nam, x$ksppsv val where nam.indx = val.indx and nam.ksppinm = '_small_table_threshold';

(ii) Check the no.of blocks statistics for the table.
SQL> SELECT blocks FROM user_tables WHERE table_name = 'TABLE_NAME';
Example:
If the blocks from user_tables for the object show 100 and _small_table_threshold is set to 480 then set the blocks statistics manually to 1000 so that it would go for direct path read.

(iii) Set the no.of blocks statistics for the tables involved in the SQL manually greater than the "_small_table_threshold" value.
SQL> EXEC DBMS_STATS.SET_TABLE_STATS('username','tabname',numblks=>n);
Example:
SQL> EXEC DBMS_STATS.SET_TABLE_STATS(user,'TEST',numblks=>1000);

There is a parameter _direct_read_decision_statistics_driven that controls this:

NAME                                               VALUE    DESCRIPTION
-------------------------------------------------- -------- ----------------------------------------------------------
_direct_read_decision_statistics_driven            TRUE     enable direct read decision based on optimizer statistics

 

标签:statistics,read,禁用,路径,direct,SQL,oracle,path,table
From: https://www.cnblogs.com/dbahrz/p/17391635.html

相关文章

  • 3511. 路由最大耗时路径
    题目描述假设存在一个二叉树型的路由器网络,经过每个路由器会有耗时。由于我们要对网络进行优化,需要找出这个树型路由器网络中的最大耗时的两个节点间的路径。路径被定义为一条从任意节点出发,达到任意节点的序列,同一个节点在一条路径序列中至多出现一次。该路径至少包含一个......
  • 62. 不同路径
    一个机器人位于一个mxn网格的左上角(起始点在下图中标记为“Start”)。机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为“Finish”)。问总共有多少条不同的路径?输入:m=3,n=7输出:28动态规划classSolution{public:int......
  • Oracle 对象批量进行授权
    环境:oracle给用户多表只读权限select'grantselecton'||owner||'.'||object_name||''to用户名;'fromdba_objectswhereownerin(‘owner’)andobject_type='TABLE';批量创建多个同义词SELECT'createorreplaceSYNONYM用户......
  • oracle 开启tnsping trace、sqlnet trace 、event10257
    在sqlnet.ora文件中加入以下参数:TNSPING.TRACE_LEVEL=SUPPORTTNSPING.TRACE_DIRECTORY=d:\oracle\trace“tnsping”工具的预期用途仅仅是测试OracleNet别名中指定的数据库侦听器是up还是down。“tnsping”工具不打算用作OracleNet性能测量工具B.Sql*nettraceSE......
  • Oracle 定时任务job实际应用
    目录一、Oracle定时任务简介二、dbms_job涉及到的知识点三、初始化相关参数job_queue_processes四、实际创建一个定时任务(一分钟执行一次),实现定时一分钟往表中插入数据4.1创建需要定时插入数据的目标表4.2创建定时执行的存储过程4.3创建定时一分钟定时任务job4.5可以根据以下......
  • 什么是 SELinux?为什么都想要禁用它?
    什么是SELinux?为什么都想要禁用它?原创 入门小站 入门小站 2023-05-0621:30 发表于湖北收录于合集#Linux778个入门小站分享运维技巧及10k+Stars的开源项目241篇原创内容公众号【Linux250个常用命令速查手册】关注【入门小站】,后台回复「1001......
  • Centos7使用ssh免密登陆同时禁用root密码登陆
    Centos7使用ssh免密登陆同时禁用root密码登陆首先配置免密登陆,参考:ssh免密登陆禁用root密码登陆修改/etc/ssh/sshd_config文件找到:RSAAuthenticationyesPubkeyAuthenticationyesAuthorizedKeysFile.ssh/authorized_keys修改上面配置项,如果默认前面带了#,就把#给删......
  • matlab程序,改进人工势场法模拟机器人路径规划与避障,障碍物的个数和坐标可以手动修改。
    matlab程序,改进人工势场法模拟机器人路径规划与避障,障碍物的个数和坐标可以手动修改。程序采用了模糊规则与人工势场算法相结合的方式来实现路径规划与避障。起点坐标,终点坐标,障碍物坐标,障碍物个数都可以在程序里直接改。ID:3960662710091016......
  • 各种路径规划算法的Matlab程序: 1.遗传算法做路径规划 2. 蚁群算法做
    各种路径规划算法的Matlab程序:1.遗传算法做路径规划2.蚁群算法做路径规划3.模拟退火算法做路径规划4.遗传算法与模拟退火算法相结合来做路径规划。ID:8460661549276422......
  • 基于遗传算法的机器人路径规划matlab程序 根据最基本的遗
    基于遗传算法的机器人路径规划matlab程序根据最基本的遗传算法原理实现了有障碍物条件下的移动机器人的路径规划问题。路径规划以最短路径为评判标准有详细的程序使用说明,可以手动修改起点坐标,终点坐标,障碍物坐标,障碍物坐标。ID:5965662020033273......