Advertisement
tmmdv

sql analysis report and fbi

Apr 26th, 2023
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. set lines 200 pages 999
  2. col plan_table_output format a180
  3. drop table t1 purge;
  4. create table t1 (id integer, x varchar2(100));
  5. insert into t1 select rownum, 'x' || mod(rownum, 500) from dual connect by level <= 50000;
  6. create index t1_indx on t1(substr(x, 2, 3));
  7. exec dbms_stats.gather_table_stats(null, 't1', method_opt=>'for all columns size 1');
  8. exec dbms_stats.gather_table_stats(null, 't1', method_opt=>'for all hidden columns size 1');
  9.  
  10. set feedback only
  11. select * from t1 where substr(x, 2, 3) = '123';
  12.  
  13. set feedback on
  14. select * from table(dbms_xplan.display_cursor(null,null,format=>'typical'));
  15.  
  16. --
  17.  
  18. SQL_ID azsfzfr3w3br1, child number 0
  19. -------------------------------------
  20. select * from t1 where substr(x, 2, 3) = '123'
  21.  
  22. Plan hash value: 3617692013
  23.  
  24. --------------------------------------------------------------------------
  25. | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
  26. --------------------------------------------------------------------------
  27. | 0 | SELECT STATEMENT | | | | 31 (100)| |
  28. |* 1 | TABLE ACCESS FULL| T1 | 100 | 1400 | 31 (4)| 00:00:01 |
  29. --------------------------------------------------------------------------
  30.  
  31. Predicate Information (identified by operation id):
  32. ---------------------------------------------------
  33.  
  34. 1 - filter(SUBSTR("X",2,3)='123')
  35.  
  36.  
  37. 18 rows selected.
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement