oracle 禁用和强制直接路径读
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
本文来自博客园,作者:蚌壳里夜有多长,转载请注明原文链接:https://www.cnblogs.com/dbahrz/p/17391635.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)