Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

DB Tech Showcase 2016 - E35 - SQLチューニング総合診療所的予防医学

7,488 views

Published on

DB Tech Showcase 2016 - E35 - SQLチューニング総合診療所的予防医学

Published in: Technology

DB Tech Showcase 2016 - E35 - SQLチューニング総合診療所的予防医学

  1. 1. 
 
 2
  2. 2. 
 3
  3. 3. 
 4
  4. 4. 
 
 
 5
  5. 5. 
 
 
 
 5
  6. 6. 
 
 
 
 6
  7. 7. 
 ✔ 
 ✔ 
 ✔ 
 ✔ 
 
 7
  8. 8. 
 
 
 
 
 8
  9. 9. 9
  10. 10. 10
  11. 11. 10
  12. 12. 10
  13. 13. 
 
 
 11
  14. 14. 12
  15. 15. 12
  16. 16. | Operation | Name | Mem | Temp | ================================================= | SELECT STATEMENT | | | | | HASH JOIN | | 4M | 1G | | PARTITION RANGE SINGLE | | | | | TABLE ACCESS FULL | FOO | | | | TABLE ACCESS FULL | BAR | | | 12
  17. 17. | Operation | Name | Mem | Temp | ================================================= | SELECT STATEMENT | | | | | HASH JOIN | | 4M | 1G | | PARTITION RANGE SINGLE | | | | | TABLE ACCESS FULL | FOO | | | | TABLE ACCESS FULL | BAR | | | 12
  18. 18. 13
  19. 19. 13
  20. 20. | Operation | Name | Mem | ========================================== | SELECT STATEMENT | | | | HASH JOIN | | 250M| | PARTITION RANGE SINGLE | | | | TABLE ACCESS FULL | FOO | | | TABLE ACCESS FULL | BAR | | 13
  21. 21. | Operation | Name | Mem | ========================================== | SELECT STATEMENT | | | | HASH JOIN | | 250M| | PARTITION RANGE SINGLE | | | | TABLE ACCESS FULL | FOO | | | TABLE ACCESS FULL | BAR | | 13
  22. 22. ----------------------------------------------------------------------------- | Id | Operation | Name | E-Rows | A-Rows | A-Time | Reads | ----------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | 0 |00:00:01.05 | 20052 | | 1 | SORT ORDER BY | | 20 | 0 |00:00:01.05 | 20052 | |* 2 | TABLE ACCESS FULL| FOOBAR | 20 | 0 |00:00:01.05 | 20052 | ----------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- | Id | Operation | Name | E-Rows | A-Rows | A-Time | Reads | Writes | Used-Mem | Used-Tmp| ----------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | 20000 |00:00:04.21 | 37325 | 17273 | | | | 1 | SORT ORDER BY | | 20000 | 20000 |00:00:04.21 | 37325 | 17273 | 71M (1)| 135K| |* 2 | TABLE ACCESS FULL| FOOBAR | 20000 | 20000 |00:00:01.25 | 20052 | 0 | | | ----------------------------------------------------------------------------------------------------------- 14
  23. 23. ----------------------------------------------------------------------------- | Id | Operation | Name | E-Rows | A-Rows | A-Time | Reads | ----------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | 0 |00:00:01.05 | 20052 | | 1 | SORT ORDER BY | | 20 | 0 |00:00:01.05 | 20052 | |* 2 | TABLE ACCESS FULL| FOOBAR | 20 | 0 |00:00:01.05 | 20052 | ----------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- | Id | Operation | Name | E-Rows | A-Rows | A-Time | Reads | Writes | Used-Mem | Used-Tmp| ----------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | 20000 |00:00:04.21 | 37325 | 17273 | | | | 1 | SORT ORDER BY | | 20000 | 20000 |00:00:04.21 | 37325 | 17273 | 71M (1)| 135K| |* 2 | TABLE ACCESS FULL| FOOBAR | 20000 | 20000 |00:00:01.25 | 20052 | 0 | | | ----------------------------------------------------------------------------------------------------------- 14
  24. 24. ----------------------------------------------------------------------------- | Id | Operation | Name | E-Rows | A-Rows | A-Time | Reads | ----------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | 0 |00:00:01.05 | 20052 | | 1 | SORT ORDER BY | | 20 | 0 |00:00:01.05 | 20052 | |* 2 | TABLE ACCESS FULL| FOOBAR | 20 | 0 |00:00:01.05 | 20052 | ----------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- | Id | Operation | Name | E-Rows | A-Rows | A-Time | Reads | Writes | Used-Mem | Used-Tmp| ----------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | 20000 |00:00:04.21 | 37325 | 17273 | | | | 1 | SORT ORDER BY | | 20000 | 20000 |00:00:04.21 | 37325 | 17273 | 71M (1)| 135K| |* 2 | TABLE ACCESS FULL| FOOBAR | 20000 | 20000 |00:00:01.25 | 20052 | 0 | | | ----------------------------------------------------------------------------------------------------------- 14
  25. 25. ----------------------------------------------------------------------------- | Id | Operation | Name | E-Rows | A-Rows | A-Time | Reads | ----------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | 0 |00:00:01.05 | 20052 | | 1 | SORT ORDER BY | | 20 | 0 |00:00:01.05 | 20052 | |* 2 | TABLE ACCESS FULL| FOOBAR | 20 | 0 |00:00:01.05 | 20052 | ----------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- | Id | Operation | Name | E-Rows | A-Rows | A-Time | Reads | Writes | Used-Mem | Used-Tmp| ----------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | 20000 |00:00:04.21 | 37325 | 17273 | | | | 1 | SORT ORDER BY | | 20000 | 20000 |00:00:04.21 | 37325 | 17273 | 71M (1)| 135K| |* 2 | TABLE ACCESS FULL| FOOBAR | 20000 | 20000 |00:00:01.25 | 20052 | 0 | | | ----------------------------------------------------------------------------------------------------------- 14
  26. 26. ----------------------------------------------------------------------------- | Id | Operation | Name | E-Rows | A-Rows | A-Time | Reads | ----------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | 0 |00:00:01.05 | 20052 | | 1 | SORT ORDER BY | | 20 | 0 |00:00:01.05 | 20052 | |* 2 | TABLE ACCESS FULL| FOOBAR | 20 | 0 |00:00:01.05 | 20052 | ----------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- | Id | Operation | Name | E-Rows | A-Rows | A-Time | Reads | Writes | Used-Mem | Used-Tmp| ----------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | 20000 |00:00:04.21 | 37325 | 17273 | | | | 1 | SORT ORDER BY | | 20000 | 20000 |00:00:04.21 | 37325 | 17273 | 71M (1)| 135K| |* 2 | TABLE ACCESS FULL| FOOBAR | 20000 | 20000 |00:00:01.25 | 20052 | 0 | | | ----------------------------------------------------------------------------------------------------------- 14
  27. 27. ----------------------------------------------------------------------------- | Id | Operation | Name | E-Rows | A-Rows | A-Time | Reads | ----------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | 0 |00:00:01.05 | 20052 | | 1 | SORT ORDER BY | | 20 | 0 |00:00:01.05 | 20052 | |* 2 | TABLE ACCESS FULL| FOOBAR | 20 | 0 |00:00:01.05 | 20052 | ----------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------- | Id | Operation | Name | E-Rows | A-Rows | A-Time | Reads | Writes | Used-Mem | Used-Tmp| ----------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | 20000 |00:00:04.21 | 37325 | 17273 | | | | 1 | SORT ORDER BY | | 20000 | 20000 |00:00:04.21 | 37325 | 17273 | 71M (1)| 135K| |* 2 | TABLE ACCESS FULL| FOOBAR | 20000 | 20000 |00:00:01.25 | 20052 | 0 | | | ----------------------------------------------------------------------------------------------------------- 14
  28. 28. ========================================================================================================= | 0 | SELECT STATEMENT | | | 1 | | | | | 1 | HASH JOIN | | | 1 | | | | | 2 | TABLE ACCESS FULL | FOOBAR | 1 | 1 | 0 | 100.00 | direct path read (1) | | 3 | TABLE ACCESS FULL | HOGEHOGE | | | | | | ========================================================================================================= 15
  29. 29. ========================================================================================================= | 0 | SELECT STATEMENT | | | 1 | | | | | 1 | HASH JOIN | | | 1 | | | | | 2 | TABLE ACCESS FULL | FOOBAR | 1 | 1 | 0 | 100.00 | direct path read (1) | | 3 | TABLE ACCESS FULL | HOGEHOGE | | | | | | ========================================================================================================= 15
  30. 30. ========================================================================================================= | 0 | SELECT STATEMENT | | | 1 | | | | | 1 | HASH JOIN | | | 1 | | | | | 2 | TABLE ACCESS FULL | FOOBAR | 1 | 1 | 0 | 100.00 | direct path read (1) | | 3 | TABLE ACCESS FULL | HOGEHOGE | | | | | | ========================================================================================================= 15
  31. 31. =============================================================================================================== | 0 | SELECT STATEMENT | | 2 | 1 | 0 | | | | 1 | HASH JOIN | | 3 | 1 | 0 | 100.00 | direct path write temp (3) | | 2 | TABLE ACCESS FULL | FOOBAR | 2 | 1 | 20000 | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | | 1 | | | | =============================================================================================================== ========================================================================================================= | 0 | SELECT STATEMENT | | | 1 | | | | | 1 | HASH JOIN | | | 1 | | | | | 2 | TABLE ACCESS FULL | FOOBAR | 1 | 1 | 0 | 100.00 | direct path read (1) | | 3 | TABLE ACCESS FULL | HOGEHOGE | | | | | | ========================================================================================================= 15
  32. 32. =============================================================================================================== | 0 | SELECT STATEMENT | | 2 | 1 | 0 | | | | 1 | HASH JOIN | | 3 | 1 | 0 | 100.00 | direct path write temp (3) | | 2 | TABLE ACCESS FULL | FOOBAR | 2 | 1 | 20000 | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | | 1 | | | | =============================================================================================================== ========================================================================================================= | 0 | SELECT STATEMENT | | | 1 | | | | | 1 | HASH JOIN | | | 1 | | | | | 2 | TABLE ACCESS FULL | FOOBAR | 1 | 1 | 0 | 100.00 | direct path read (1) | | 3 | TABLE ACCESS FULL | HOGEHOGE | | | | | | ========================================================================================================= 15
  33. 33. =============================================================================================================== | 0 | SELECT STATEMENT | | 2 | 1 | 0 | | | | 1 | HASH JOIN | | 3 | 1 | 0 | 100.00 | direct path write temp (3) | | 2 | TABLE ACCESS FULL | FOOBAR | 2 | 1 | 20000 | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | | 1 | | | | =============================================================================================================== ========================================================================================================= | 0 | SELECT STATEMENT | | | 1 | | | | | 1 | HASH JOIN | | | 1 | | | | | 2 | TABLE ACCESS FULL | FOOBAR | 1 | 1 | 0 | 100.00 | direct path read (1) | | 3 | TABLE ACCESS FULL | HOGEHOGE | | | | | | ========================================================================================================= 15
  34. 34. ============================================================================================================== | Id | Operation | Name | Time | Execs | Rows | Activity | Activity Detail | | | | | Active(s) | | (Actual) | (%) | (# samples) | ============================================================================================================== | 0 | SELECT STATEMENT | | 229 | 1 | 400K | 25.00 | Cpu (2) | | 1 | HASH JOIN | | 229 | 1 | 400K | 50.00 | Cpu (3) | | | | | | | | | direct path read temp (1) | | 2 | TABLE ACCESS FULL | FOOBAR | 3 | 1 | 20000 | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | 107 | 1 | 20000 | 12.50 | Cpu (1) | ============================================================================================================== =============================================================================================================== | 0 | SELECT STATEMENT | | 2 | 1 | 0 | | | | 1 | HASH JOIN | | 3 | 1 | 0 | 100.00 | direct path write temp (3) | | 2 | TABLE ACCESS FULL | FOOBAR | 2 | 1 | 20000 | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | | 1 | | | | =============================================================================================================== ========================================================================================================= | 0 | SELECT STATEMENT | | | 1 | | | | | 1 | HASH JOIN | | | 1 | | | | | 2 | TABLE ACCESS FULL | FOOBAR | 1 | 1 | 0 | 100.00 | direct path read (1) | | 3 | TABLE ACCESS FULL | HOGEHOGE | | | | | | ========================================================================================================= 15
  35. 35. ============================================================================================================== | Id | Operation | Name | Time | Execs | Rows | Activity | Activity Detail | | | | | Active(s) | | (Actual) | (%) | (# samples) | ============================================================================================================== | 0 | SELECT STATEMENT | | 229 | 1 | 400K | 25.00 | Cpu (2) | | 1 | HASH JOIN | | 229 | 1 | 400K | 50.00 | Cpu (3) | | | | | | | | | direct path read temp (1) | | 2 | TABLE ACCESS FULL | FOOBAR | 3 | 1 | 20000 | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | 107 | 1 | 20000 | 12.50 | Cpu (1) | ============================================================================================================== =============================================================================================================== | 0 | SELECT STATEMENT | | 2 | 1 | 0 | | | | 1 | HASH JOIN | | 3 | 1 | 0 | 100.00 | direct path write temp (3) | | 2 | TABLE ACCESS FULL | FOOBAR | 2 | 1 | 20000 | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | | 1 | | | | =============================================================================================================== ========================================================================================================= | 0 | SELECT STATEMENT | | | 1 | | | | | 1 | HASH JOIN | | | 1 | | | | | 2 | TABLE ACCESS FULL | FOOBAR | 1 | 1 | 0 | 100.00 | direct path read (1) | | 3 | TABLE ACCESS FULL | HOGEHOGE | | | | | | ========================================================================================================= 15
  36. 36. ============================================================================================================== | Id | Operation | Name | Time | Execs | Rows | Activity | Activity Detail | | | | | Active(s) | | (Actual) | (%) | (# samples) | ============================================================================================================== | 0 | SELECT STATEMENT | | 229 | 1 | 400K | 25.00 | Cpu (2) | | 1 | HASH JOIN | | 229 | 1 | 400K | 50.00 | Cpu (3) | | | | | | | | | direct path read temp (1) | | 2 | TABLE ACCESS FULL | FOOBAR | 3 | 1 | 20000 | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | 107 | 1 | 20000 | 12.50 | Cpu (1) | ============================================================================================================== =============================================================================================================== | 0 | SELECT STATEMENT | | 2 | 1 | 0 | | | | 1 | HASH JOIN | | 3 | 1 | 0 | 100.00 | direct path write temp (3) | | 2 | TABLE ACCESS FULL | FOOBAR | 2 | 1 | 20000 | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | | 1 | | | | =============================================================================================================== ========================================================================================================= | 0 | SELECT STATEMENT | | | 1 | | | | | 1 | HASH JOIN | | | 1 | | | | | 2 | TABLE ACCESS FULL | FOOBAR | 1 | 1 | 0 | 100.00 | direct path read (1) | | 3 | TABLE ACCESS FULL | HOGEHOGE | | | | | | ========================================================================================================= 15
  37. 37. ID COUNT(1) ---------- ---------- 1 2000 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 ID COUNT(1) ---------- ---------- 1 20000 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 ID COUNT(1) ---------- ---------- 1 2 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 ID COUNT(1) ---------- ---------- 1 2 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 16
  38. 38. ID COUNT(1) ---------- ---------- 1 2000 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 ID COUNT(1) ---------- ---------- 1 20000 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 ID COUNT(1) ---------- ---------- 1 2 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 ID COUNT(1) ---------- ---------- 1 2 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 16
  39. 39. ID COUNT(1) ---------- ---------- 1 2000 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 ID COUNT(1) ---------- ---------- 1 20000 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 ID COUNT(1) ---------- ---------- 1 2 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 ID COUNT(1) ---------- ---------- 1 2 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 16
  40. 40. ID COUNT(1) ---------- ---------- 1 2000 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 ID COUNT(1) ---------- ---------- 1 20000 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 ID COUNT(1) ---------- ---------- 1 2 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 ID COUNT(1) ---------- ---------- 1 2 25 20 22 20 34 20 30 20 940 20 912 20 930 20 885 20 906 20 925 20 16
  41. 41. =================================================================================================================== | Id | Operation | Name | Rows | Time | Rows | Mem | Activity | Activity Detail | | | | | (Estim) | Active(s) | (Actual) | (Max) | (%) | (# samples) | =================================================================================================================== | 0 | SELECT STATEMENT | | | 225 | 400K | | 75.00 | Cpu (3) | | 1 | HASH JOIN | | 401K | 225 | 400K | 17M | | | | 2 | TABLE ACCESS FULL | FOOBAR | 2000 | 1 | 2000 | | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | 20291 | 225 | 20000 | | 25.00 | direct path read (1) | =================================================================================================================== =================================================================================================================== | 0 | SELECT STATEMENT | | | 1 | 4 | | | | | 1 | HASH JOIN | | 23 | 1 | 4 | 458K | | | | 2 | TABLE ACCESS FULL | FOOBAR | 20 | 1 | 2 | | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | 313 | 1 | 2 | | 100.00 | direct path read (1) | =================================================================================================================== 17
  42. 42. =================================================================================================================== | Id | Operation | Name | Rows | Time | Rows | Mem | Activity | Activity Detail | | | | | (Estim) | Active(s) | (Actual) | (Max) | (%) | (# samples) | =================================================================================================================== | 0 | SELECT STATEMENT | | | 225 | 400K | | 75.00 | Cpu (3) | | 1 | HASH JOIN | | 401K | 225 | 400K | 17M | | | | 2 | TABLE ACCESS FULL | FOOBAR | 2000 | 1 | 2000 | | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | 20291 | 225 | 20000 | | 25.00 | direct path read (1) | =================================================================================================================== =================================================================================================================== | 0 | SELECT STATEMENT | | | 1 | 4 | | | | | 1 | HASH JOIN | | 23 | 1 | 4 | 458K | | | | 2 | TABLE ACCESS FULL | FOOBAR | 20 | 1 | 2 | | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | 313 | 1 | 2 | | 100.00 | direct path read (1) | =================================================================================================================== 17
  43. 43. =================================================================================================================== | Id | Operation | Name | Rows | Time | Rows | Mem | Activity | Activity Detail | | | | | (Estim) | Active(s) | (Actual) | (Max) | (%) | (# samples) | =================================================================================================================== | 0 | SELECT STATEMENT | | | 225 | 400K | | 75.00 | Cpu (3) | | 1 | HASH JOIN | | 401K | 225 | 400K | 17M | | | | 2 | TABLE ACCESS FULL | FOOBAR | 2000 | 1 | 2000 | | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | 20291 | 225 | 20000 | | 25.00 | direct path read (1) | =================================================================================================================== =================================================================================================================== | 0 | SELECT STATEMENT | | | 1 | 4 | | | | | 1 | HASH JOIN | | 23 | 1 | 4 | 458K | | | | 2 | TABLE ACCESS FULL | FOOBAR | 20 | 1 | 2 | | | | | 3 | TABLE ACCESS FULL | HOGEHOGE | 313 | 1 | 2 | | 100.00 | direct path read (1) | =================================================================================================================== 17
  44. 44. 18
  45. 45. ID COL1 COL2 ---------- ------------------------------ -------------- 2 ****************************** ************** 4 ****************************** ************** 5 ****************************** ************** 3 ****************************** ************** 1 ****************************** ************** 8 ****************************** ************** 9 ****************************** ************** 10 ****************************** ************** 11 ****************************** ************** 12 ****************************** ************** 
 
 18
  46. 46. ID COL1 COL2 ---------- ------------------------------ -------------- 2 ****************************** ************** 4 ****************************** ************** 5 ****************************** ************** 3 ****************************** ************** 1 ****************************** ************** 8 ****************************** ************** 9 ****************************** ************** 10 ****************************** ************** 11 ****************************** ************** 12 ****************************** ************** 
 
 18
  47. 47. ID COL1 COL2 ---------- ------------------------------ -------------- 2 ****************************** ************** 4 ****************************** ************** 5 ****************************** ************** 3 ****************************** ************** 1 ****************************** ************** 8 ****************************** ************** 9 ****************************** ************** 10 ****************************** ************** 11 ****************************** ************** 12 ****************************** ************** 
 
 18
  48. 48. 
 SEGMENT_NAME SUM(BLOCKS) MB ------------- ----------- ---------- SEGMENTSIZE 1024 8 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SEGMENTSIZE ID 0 1000 .001 4 1 NONE SEGMENTSIZE DATA1 0 1 1 4001 1 NONE SEGMENTSIZE DATA2 0 1 1 3001 1 NONE 19
  49. 49. 
 SEGMENT_NAME SUM(BLOCKS) MB ------------- ----------- ---------- SEGMENTSIZE 1024 8 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SEGMENTSIZE ID 0 1000 .001 4 1 NONE SEGMENTSIZE DATA1 0 1 1 4001 1 NONE SEGMENTSIZE DATA2 0 1 1 3001 1 NONE 19
  50. 50. 
 SEGMENT_NAME SUM(BLOCKS) MB ------------- ----------- ---------- SEGMENTSIZE 1024 8 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SEGMENTSIZE ID 0 1000 .001 4 1 NONE SEGMENTSIZE DATA1 0 1 1 4001 1 NONE SEGMENTSIZE DATA2 0 1 1 3001 1 NONE 19
  51. 51. 
 SEGMENT_NAME SUM(BLOCKS) MB ------------- ----------- ---------- SEGMENTSIZE 1024 8 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SEGMENTSIZE ID 0 1000 .001 4 1 NONE SEGMENTSIZE DATA1 0 1 1 4001 1 NONE SEGMENTSIZE DATA2 0 1 1 3001 1 NONE SEGMENT_NAME SUM(BLOCKS) MB ----------------- ----------- ---------- SMALL_SEGMENTSIZE 8 .0625 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ----------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SMALL_SEGMENTSIZE ID 0 1000 .001 4 1 NONE SMALL_SEGMENTSIZE DATA1 0 1 1 3 1 NONE SMALL_SEGMENTSIZE DATA2 0 1 1 6 1 NONE 19
  52. 52. 
 SEGMENT_NAME SUM(BLOCKS) MB ------------- ----------- ---------- SEGMENTSIZE 1024 8 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SEGMENTSIZE ID 0 1000 .001 4 1 NONE SEGMENTSIZE DATA1 0 1 1 4001 1 NONE SEGMENTSIZE DATA2 0 1 1 3001 1 NONE SEGMENT_NAME SUM(BLOCKS) MB ----------------- ----------- ---------- SMALL_SEGMENTSIZE 8 .0625 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ----------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SMALL_SEGMENTSIZE ID 0 1000 .001 4 1 NONE SMALL_SEGMENTSIZE DATA1 0 1 1 3 1 NONE SMALL_SEGMENTSIZE DATA2 0 1 1 6 1 NONE 19
  53. 53. 
 SEGMENT_NAME SUM(BLOCKS) MB ------------- ----------- ---------- SEGMENTSIZE 1024 8 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SEGMENTSIZE ID 0 1000 .001 4 1 NONE SEGMENTSIZE DATA1 0 1 1 4001 1 NONE SEGMENTSIZE DATA2 0 1 1 3001 1 NONE SEGMENT_NAME SUM(BLOCKS) MB ----------------- ----------- ---------- SMALL_SEGMENTSIZE 8 .0625 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ----------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SMALL_SEGMENTSIZE ID 0 1000 .001 4 1 NONE SMALL_SEGMENTSIZE DATA1 0 1 1 3 1 NONE SMALL_SEGMENTSIZE DATA2 0 1 1 6 1 NONE 19
  54. 54. 
 SEGMENT_NAME SUM(BLOCKS) MB ------------- ----------- ---------- SEGMENTSIZE 1024 8 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SEGMENTSIZE ID 0 1000 .001 4 1 NONE SEGMENTSIZE DATA1 0 1 1 4001 1 NONE SEGMENTSIZE DATA2 0 1 1 3001 1 NONE SEGMENT_NAME SUM(BLOCKS) MB ----------------- ----------- ---------- SMALL_SEGMENTSIZE 8 .0625 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ----------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SMALL_SEGMENTSIZE ID 0 1000 .001 4 1 NONE SMALL_SEGMENTSIZE DATA1 0 1 1 3 1 NONE SMALL_SEGMENTSIZE DATA2 0 1 1 6 1 NONE 19
  55. 55. 
 SEGMENT_NAME SUM(BLOCKS) MB ------------- ----------- ---------- SEGMENTSIZE 1024 8 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SEGMENTSIZE ID 0 1000 .001 4 1 NONE SEGMENTSIZE DATA1 0 1 1 4001 1 NONE SEGMENTSIZE DATA2 0 1 1 3001 1 NONE SEGMENT_NAME SUM(BLOCKS) MB ----------------- ----------- ---------- SMALL_SEGMENTSIZE 8 .0625 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ----------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SMALL_SEGMENTSIZE ID 0 1000 .001 4 1 NONE SMALL_SEGMENTSIZE DATA1 0 1 1 3 1 NONE SMALL_SEGMENTSIZE DATA2 0 1 1 6 1 NONE 19
  56. 56. 
 SEGMENT_NAME SUM(BLOCKS) MB ------------- ----------- ---------- SEGMENTSIZE 1024 8 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SEGMENTSIZE ID 0 1000 .001 4 1 NONE SEGMENTSIZE DATA1 0 1 1 4001 1 NONE SEGMENTSIZE DATA2 0 1 1 3001 1 NONE SEGMENT_NAME SUM(BLOCKS) MB ----------------- ----------- ---------- SMALL_SEGMENTSIZE 8 .0625 TABLE_NAME COLUMN_NAME NUM_NULLS NUM_DISTINCT DENSITY AVG_COL_LEN NUM_BUCKETS HISTOGRAM ----------------- ------------ --------- ------------ ---------- ----------- ----------- ---------- SMALL_SEGMENTSIZE ID 0 1000 .001 4 1 NONE SMALL_SEGMENTSIZE DATA1 0 1 1 3 1 NONE SMALL_SEGMENTSIZE DATA2 0 1 1 6 1 NONE 19
  57. 57. 
 ============================================================================== | Id | Operation | Name | Rows | Rows | Read | Read | | | | | (Estim) | (Actual) | Reqs | Bytes | ============================================================================== | 0 | SELECT STATEMENT | | | 1000 | | | | 1 | TABLE ACCESS FULL | SEGMENTSIZE | 1000 | 1000 | 37 | 8MB | ============================================================================== ==================================================================================== | Id | Operation | Name | Rows | Rows | Read | Read | | | | | (Estim) | (Actual) | Reqs | Bytes | ==================================================================================== | 0 | SELECT STATEMENT | | | 1000 | | | | 1 | TABLE ACCESS FULL | SMALL_SEGMENTSIZE | 1000 | 1000 | 2 | 32768 | ==================================================================================== 20
  58. 58. 21
  59. 59. Plan hash value: 3426918692 ----------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | ----------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | |* 1 | FILTER | | 1 | | | 2 | TABLE ACCESS BY INDEX ROWID| FOO | 1 | 50 | |* 3 | INDEX RANGE SCAN | PK_FOO | 1 | 50 | ----------------------------------------------------------------- Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 22
  60. 60. ✋ Plan hash value: 3426918692 ----------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | ----------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | |* 1 | FILTER | | 1 | | | 2 | TABLE ACCESS BY INDEX ROWID| FOO | 1 | 50 | |* 3 | INDEX RANGE SCAN | PK_FOO | 1 | 50 | ----------------------------------------------------------------- Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 23
  61. 61. ✋ Plan hash value: 3426918692 ----------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | ----------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | |* 1 | FILTER | | 1 | | | 2 | TABLE ACCESS BY INDEX ROWID| FOO | 1 | 50 | |* 3 | INDEX RANGE SCAN | PK_FOO | 1 | 50 | ----------------------------------------------------------------- Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 24
  62. 62. ✋ Plan hash value: 3426918692 ----------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | ----------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | |* 1 | FILTER | | 1 | | | 2 | TABLE ACCESS BY INDEX ROWID| FOO | 1 | 50 | |* 3 | INDEX RANGE SCAN | PK_FOO | 1 | 50 | ----------------------------------------------------------------- Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- INDEX_NAME UNIQUENES DISTINCT_KEYS CLUSTERING_FACTOR ---------- --------- ------------- ----------------- PK_FOO UNIQUE 20000 19993 
   可能性が高い 24
  63. 63. Plan hash value: 3426918692 ----------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | ----------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | |* 1 | FILTER | | 1 | | | 2 | TABLE ACCESS BY INDEX ROWID| FOO | 1 | 50 | |* 3 | INDEX RANGE SCAN | PK_FOO | 1 | 50 | ----------------------------------------------------------------- Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 25
  64. 64. Plan hash value: 3426918692 ----------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | ----------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | |* 1 | FILTER | | 1 | | | 2 | TABLE ACCESS BY INDEX ROWID| FOO | 1 | 50 | |* 3 | INDEX RANGE SCAN | PK_FOO | 1 | 50 | ----------------------------------------------------------------- Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 25
  65. 65. Plan hash value: 3426918692 ----------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | ----------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | |* 1 | FILTER | | 1 | | | 2 | TABLE ACCESS BY INDEX ROWID| FOO | 1 | 50 | |* 3 | INDEX RANGE SCAN | PK_FOO | 1 | 50 | ----------------------------------------------------------------- Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 25
  66. 66. 
 Plan hash value: 3426918692 ----------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | ----------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | |* 1 | FILTER | | 1 | | | 2 | TABLE ACCESS BY INDEX ROWID| FOO | 1 | 50 | |* 3 | INDEX RANGE SCAN | PK_FOO | 1 | 50 | ----------------------------------------------------------------- Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 26
  67. 67. 
 Plan hash value: 3426918692 ----------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | ----------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | |* 1 | FILTER | | 1 | | | 2 | TABLE ACCESS BY INDEX ROWID| FOO | 1 | 50 | |* 3 | INDEX RANGE SCAN | PK_FOO | 1 | 50 | ----------------------------------------------------------------- Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 26
  68. 68. 
 Plan hash value: 3426918692 ----------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | ----------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | |* 1 | FILTER | | 1 | | | 2 | TABLE ACCESS BY INDEX ROWID| FOO | 1 | 50 | |* 3 | INDEX RANGE SCAN | PK_FOO | 1 | 50 | ----------------------------------------------------------------- Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 26
  69. 69. 
 Plan hash value: 3426918692 ----------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | ----------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | |* 1 | FILTER | | 1 | | | 2 | TABLE ACCESS BY INDEX ROWID| FOO | 1 | 50 | |* 3 | INDEX RANGE SCAN | PK_FOO | 1 | 50 | ----------------------------------------------------------------- Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 27
  70. 70. ✋ 
 28
  71. 71. INDEX_NAME CLUSTERING_FACTOR NUM_OF_TABLE_BLOCKS NUM_OF_TABLE_ROWS ----------- ----------------- ------------------- ----------------- PK_HICLS 992 80 1000 PK_LOCLS 72 80 1000 29
  72. 72. INDEX_NAME CLUSTERING_FACTOR NUM_OF_TABLE_BLOCKS NUM_OF_TABLE_ROWS ----------- ----------------- ------------------- ----------------- PK_HICLS 992 80 1000 PK_LOCLS 72 80 1000 29
  73. 73. INDEX_NAME CLUSTERING_FACTOR NUM_OF_TABLE_BLOCKS NUM_OF_TABLE_ROWS ----------- ----------------- ------------------- ----------------- PK_HICLS 992 80 1000 PK_LOCLS 72 80 1000 29
  74. 74. 
 30
  75. 75. Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 
 Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 31
  76. 76. 
 
 32
  77. 77. Plan Hash # Value Executions --- ---------------- -------------- 1 1885085827 2000 2 1756993664 2000 3 3400946141 2000 4 13177233 2000 5 3564047035 2000 33
  78. 78. Plan Hash # Value Executions --- ---------------- -------------- 1 1885085827 2000 2 1756993664 2000 3 3400946141 2000 4 13177233 2000 5 3564047035 2000 33
  79. 79. 34
  80. 80. |MERGE JOIN | | | TABLE ACCESS BY INDEX ROWID| FOO | | INDEX RANGE SCAN | PK_FOO | | SORT JOIN | | | TABLE ACCESS FULL | BAR | |HASH JOIN | | | TABLE ACCESS FULL| FOO | | TABLE ACCESS FULL| BAR | |NESTED LOOPS | | | NESTED LOOPS | | | TABLE ACCESS FULL | FOO | | INDEX RANGE SCAN | PK_BAR | | TABLE ACCESS BY INDEX ROWID| BAR | |NESTED LOOPS | | | NESTED LOOPS | | | TABLE ACCESS BY INDEX ROWID BATCHED| FOO | | INDEX RANGE SCAN | PK_FOO | | INDEX RANGE SCAN | PK_BAR | | TABLE ACCESS BY INDEX ROWID | BAR | |HASH JOIN | | TABLE ACCESS BY INDEX ROWID BATCHED| FOO | INDEX RANGE SCAN | PK_FOO | TABLE ACCESS BY INDEX ROWID BATCHED| BAR | INDEX RANGE SCAN | PK_BAR 34
  81. 81. Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 
 Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 35
  82. 82. Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 
 Plan hash value: 2962421549 -------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows |E-Bytes| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | | | 1 | SORT ORDER BY | | 1 | 5000 | 2485K| |* 2 | FILTER | | 1 | | | |* 3 | TABLE ACCESS FULL| FOO | 1 | 5000 | 2485K| -------------------------------------------------------------- 
 
 35
  83. 83. |MERGE JOIN | | | TABLE ACCESS BY INDEX ROWID| FOO | | INDEX RANGE SCAN | PK_FOO | | SORT JOIN | | | TABLE ACCESS FULL | BAR | |HASH JOIN | | | TABLE ACCESS FULL| FOO | | TABLE ACCESS FULL| BAR | |NESTED LOOPS | | | NESTED LOOPS | | | TABLE ACCESS FULL | FOO | | INDEX RANGE SCAN | PK_BAR | | TABLE ACCESS BY INDEX ROWID| BAR | |NESTED LOOPS | | | NESTED LOOPS | | | TABLE ACCESS BY INDEX ROWID BATCHED| FOO | | INDEX RANGE SCAN | PK_FOO | | INDEX RANGE SCAN | PK_BAR | | TABLE ACCESS BY INDEX ROWID | BAR | |HASH JOIN | | TABLE ACCESS BY INDEX ROWID BATCHED| FOO | INDEX RANGE SCAN | PK_FOO | TABLE ACCESS BY INDEX ROWID BATCHED| BAR | INDEX RANGE SCAN | PK_BAR :v1 = 1
 :v2 = 2120 :v3 = 2000 :v1 = 200
 :v2 = 2300 :v3 = 2000 :v1 = 50
 :v2 = 300 :v3 = 2000 :v1 = 15000
 :v2 = 17400 :v3 = 2000 :v1 = x
 :v2 = x+300 :v3 = 2000 36
  84. 84. |MERGE JOIN | | | TABLE ACCESS BY INDEX ROWID| FOO | | INDEX RANGE SCAN | PK_FOO | | SORT JOIN | | | TABLE ACCESS FULL | BAR | |HASH JOIN | | | TABLE ACCESS FULL| FOO | | TABLE ACCESS FULL| BAR | |NESTED LOOPS | | | NESTED LOOPS | | | TABLE ACCESS FULL | FOO | | INDEX RANGE SCAN | PK_BAR | | TABLE ACCESS BY INDEX ROWID| BAR | |NESTED LOOPS | | | NESTED LOOPS | | | TABLE ACCESS BY INDEX ROWID BATCHED| FOO | | INDEX RANGE SCAN | PK_FOO | | INDEX RANGE SCAN | PK_BAR | | TABLE ACCESS BY INDEX ROWID | BAR | |HASH JOIN | | TABLE ACCESS BY INDEX ROWID BATCHED| FOO | INDEX RANGE SCAN | PK_FOO | TABLE ACCESS BY INDEX ROWID BATCHED| BAR | INDEX RANGE SCAN | PK_BAR :v1 = 1
 :v2 = 2120 :v3 = 2000 :v1 = 200
 :v2 = 2300 :v3 = 2000 :v1 = 50
 :v2 = 300 :v3 = 2000 :v1 = 15000
 :v2 = 17400 :v3 = 2000 :v1 = x
 :v2 = x+300 :v3 = 2000 36
  85. 85. |MERGE JOIN | | | TABLE ACCESS BY INDEX ROWID| FOO | | INDEX RANGE SCAN | PK_FOO | | SORT JOIN | | | TABLE ACCESS FULL | BAR | |HASH JOIN | | | TABLE ACCESS FULL| FOO | | TABLE ACCESS FULL| BAR | |NESTED LOOPS | | | NESTED LOOPS | | | TABLE ACCESS FULL | FOO | | INDEX RANGE SCAN | PK_BAR | | TABLE ACCESS BY INDEX ROWID| BAR | |NESTED LOOPS | | | NESTED LOOPS | | | TABLE ACCESS BY INDEX ROWID BATCHED| FOO | | INDEX RANGE SCAN | PK_FOO | | INDEX RANGE SCAN | PK_BAR | | TABLE ACCESS BY INDEX ROWID | BAR | |HASH JOIN | | TABLE ACCESS BY INDEX ROWID BATCHED| FOO | INDEX RANGE SCAN | PK_FOO | TABLE ACCESS BY INDEX ROWID BATCHED| BAR | INDEX RANGE SCAN | PK_BAR :v1 = 1
 :v2 = 2120 :v3 = 2000 :v1 = 200
 :v2 = 2300 :v3 = 2000 :v1 = 50
 :v2 = 300 :v3 = 2000 :v1 = 15000
 :v2 = 17400 :v3 = 2000 :v1 = x
 :v2 = x+300 :v3 = 2000 36
  86. 86. |MERGE JOIN | | | TABLE ACCESS BY INDEX ROWID| FOO | | INDEX RANGE SCAN | PK_FOO | | SORT JOIN | | | TABLE ACCESS FULL | BAR | |HASH JOIN | | | TABLE ACCESS FULL| FOO | | TABLE ACCESS FULL| BAR | |NESTED LOOPS | | | NESTED LOOPS | | | TABLE ACCESS FULL | FOO | | INDEX RANGE SCAN | PK_BAR | | TABLE ACCESS BY INDEX ROWID| BAR | |NESTED LOOPS | | | NESTED LOOPS | | | TABLE ACCESS BY INDEX ROWID BATCHED| FOO | | INDEX RANGE SCAN | PK_FOO | | INDEX RANGE SCAN | PK_BAR | | TABLE ACCESS BY INDEX ROWID | BAR | |HASH JOIN | | TABLE ACCESS BY INDEX ROWID BATCHED| FOO | INDEX RANGE SCAN | PK_FOO | TABLE ACCESS BY INDEX ROWID BATCHED| BAR | INDEX RANGE SCAN | PK_BAR :v1 = 1
 :v2 = 2120 :v3 = 2000 :v1 = 200
 :v2 = 2300 :v3 = 2000 :v1 = 50
 :v2 = 300 :v3 = 2000 :v1 = 15000
 :v2 = 17400 :v3 = 2000 :v1 = x
 :v2 = x+300 :v3 = 2000 37
  87. 87. Plan Hash # Value Executions --- ---------------- ------------- 1 1756993664 2000 2 3400946141 2000 3 1885085827 2000 4 13177233 2000 5 3564047035 2000 1 1756993664 2004 2 3564047035 5991 3 13177233 2000 4 3400946141 4 5 1885085827 1 1 13177233 10,000 Plan Hash # Value Executions --- ---------------- ------------- 1 3564047035 10,000 2 13177233 0 1 3564047035 10,000 38
  88. 88. Plan Hash # Value Executions --- ---------------- ------------- 1 1756993664 2000 2 3400946141 2000 3 1885085827 2000 4 13177233 2000 5 3564047035 2000 1 1756993664 2004 2 3564047035 5991 3 13177233 2000 4 3400946141 4 5 1885085827 1 1 13177233 10,000 Plan Hash # Value Executions --- ---------------- ------------- 1 3564047035 10,000 2 13177233 0 1 3564047035 10,000 38
  89. 89. Plan Hash # Value Executions --- ---------------- ------------- 1 1756993664 2000 2 3400946141 2000 3 1885085827 2000 4 13177233 2000 5 3564047035 2000 1 1756993664 2004 2 3564047035 5991 3 13177233 2000 4 3400946141 4 5 1885085827 1 1 13177233 10,000 Plan Hash # Value Executions --- ---------------- ------------- 1 3564047035 10,000 2 13177233 0 1 3564047035 10,000 38
  90. 90. Plan Hash # Value Executions --- ---------------- ------------- 1 1756993664 2000 2 3400946141 2000 3 1885085827 2000 4 13177233 2000 5 3564047035 2000 1 1756993664 2004 2 3564047035 5991 3 13177233 2000 4 3400946141 4 5 1885085827 1 1 13177233 10,000 Plan Hash # Value Executions --- ---------------- ------------- 1 3564047035 10,000 2 13177233 0 1 3564047035 10,000 38
  91. 91. Plan Hash # Value Executions --- ---------------- ------------- 1 1756993664 2000 2 3400946141 2000 3 1885085827 2000 4 13177233 2000 5 3564047035 2000 1 1756993664 2004 2 3564047035 5991 3 13177233 2000 4 3400946141 4 5 1885085827 1 1 13177233 10,000 Plan Hash # Value Executions --- ---------------- ------------- 1 3564047035 10,000 2 13177233 0 1 3564047035 10,000 38
  92. 92. Plan Hash # Value Executions --- ---------------- ------------- 1 1756993664 2000 2 3400946141 2000 3 1885085827 2000 4 13177233 2000 5 3564047035 2000 1 1756993664 2004 2 3564047035 5991 3 13177233 2000 4 3400946141 4 5 1885085827 1 1 13177233 10,000 Plan Hash # Value Executions --- ---------------- ------------- 1 3564047035 10,000 2 13177233 0 1 3564047035 10,000 38
  93. 93. 
 39
  94. 94. 40
  95. 95. 40
  96. 96. 40
  97. 97. 
 40
  98. 98. 
 40
  99. 99. 
 
 
 
 
 41
  100. 100. 42
  101. 101. 
 
 43
  102. 102. 
 
 ✔dba_sql_plan_dir_objects OWNER OBJECT OBJECT_NAME SUBOBJECT_NAME --------- ------ --------------- ------------------ MDSYS COLUMN RDF_LINK$ CANON_END_NODE_ID MDSYS COLUMN RDF_LINK$ G_ID MDSYS COLUMN RDF_LINK$ P_VALUE_ID MDSYS COLUMN RDF_LINK$ START_NODE_ID MDSYS TABLE RDF_LINK$ SH COLUMN PRODUCTS PROD_CATEGORY SH COLUMN PRODUCTS PROD_ID SH TABLE PRODUCTS ✔dba_sql_plan_directives; TYPE REASON ---------------- ------------------------------------ DYNAMIC_SAMPLING SINGLE TABLE CARDINALITY MISESTIMATE DYNAMIC_SAMPLING JOIN CARDINALITY MISESTIMATE DYNAMIC_SAMPLING GROUP BY CARDINALITY MISESTIMATE 43
  103. 103. 
 
 
 
 
 43
  104. 104. 
 
 44
  105. 105. 
 
 
 
 
 45
  106. 106. CBO (Cost Base Optimizer) SQL Transformation
 (Join Elimination, View Merge, Vector Transform) Bind Peek Adaptive Cursor Sharing Statistics Feedback Dynamic Statistics Adaptive Plan SQL Plan Directives SQL Plan stability Management SQL Hints 46
  107. 107. CBO (Cost Base Optimizer) SQL Transformation
 (Join Elimination, View Merge, Vector Transform) Bind Peek Adaptive Cursor Sharing Statistics Feedback Dynamic Statistics Adaptive Plan SQL Plan Directives SQL Plan stability Management SQL Hints ✌46

×