Created
May 24, 2022 23:17
-
-
Save xtender/3c2d608f0d8de6b63b78f814903c70ea to your computer and use it in GitHub Desktop.
Controlling “direct path reads” decision with "table_stats" hint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SQL> select name,block_size,buffers from v$buffer_pool; | |
NAME BLOCK_SIZE BUFFERS | |
-------------------- ---------- ---------- | |
DEFAULT 8192 41118 | |
SQL> col vlot new_value vlot; | |
SQL> select buffers*5+1 as vlot from v$buffer_pool; | |
VLOT | |
---------- | |
205591 | |
SQL> create table t_direct as select 1 x from dual; | |
Table created. | |
SQL> select name,value from v$statname n,v$sesstat s where s.sid=userenv('sid') and s.statistic#=n.statistic# and name='physical reads direct'; | |
NAME VALUE | |
---------------------------------------------------------------- ---------- | |
physical reads direct 0 | |
SQL> select count(*) from t_direct; | |
COUNT(*) | |
---------- | |
1 | |
SQL> select name,value from v$statname n,v$sesstat s where s.sid=userenv('sid') and s.statistic#=n.statistic# and name='physical reads direct'; | |
NAME VALUE | |
---------------------------------------------------------------- ---------- | |
physical reads direct 0 | |
SQL> select/*+ table_stats(t_direct set rows=1000000 blocks=&vlot) */ count(*) from t_direct; | |
COUNT(*) | |
---------- | |
1 | |
SQL> select name,value from v$statname n,v$sesstat s where s.sid=userenv('sid') and s.statistic#=n.statistic# and name='physical reads direct'; | |
NAME VALUE | |
---------------------------------------------------------------- ---------- | |
physical reads direct 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@vparam_ _very_large_object_threshold | |
select name,block_size,buffers from v$buffer_pool; | |
col vlot new_value vlot; | |
select buffers*5+1 as vlot from v$buffer_pool; | |
create table t_direct as select 1 x from dual; | |
select name,value from v$statname n,v$sesstat s where s.sid=userenv('sid') and s.statistic#=n.statistic# and name='physical reads direct'; | |
select count(*) from t_direct; | |
select name,value from v$statname n,v$sesstat s where s.sid=userenv('sid') and s.statistic#=n.statistic# and name='physical reads direct'; | |
select/*+ table_stats(t_direct set rows=1000000 blocks=&vlot) */ count(*) from t_direct; | |
select name,value from v$statname n,v$sesstat s where s.sid=userenv('sid') and s.statistic#=n.statistic# and name='physical reads direct'; |
Author
xtender
commented
May 24, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment