Oracle Hint เทคนิคการ Query เพื่อ Tuning Performance

บทความเกี่ยวกับ : Oracle Hint เทคนิคการ Query เพื่อ Tuning Performance


การใส่ Hint ตาม Format นี้เลยครับ
SELECT /*+ HINT */  * from  tbl

ตัวอย่างเช่นการบังคับให้ Query แบบ FULL คือไม่ใช้ Index
SELECT /*+ FULL(x) */ FROM tab1 

ตัวอย่างการบังคับให้ Query โดยใจ Index ตามที่ระบุ
SELECT /*+ INDEX(test_idx1) */ * FROM tbl





ตามนี้เลยครับสามารถช่วยได้เยอะเลยทีเดียวส่วน Hint มีอะไรบ้างนั้นตามด้านล่างเลยครับ
    *  ORDERED - usually with USE_NL to get Oracle to not hash join
    * INDEX(t index_name) - where Oracle chooses the wrong index over the correct one
    * NO_INDEX - prevent an index from being used
    * INDEX_COMBINE - merging bitmap indexes (use when Oracle does not merge bitmap indexes)
    * FIRST_ROWS(n) - when you only want the first few rows
    * PARALLEL - to force parallel query on certain specific queries
    * GATHER_PLAN_STATISTICS - used as a handy sql trace
    * DYNAMIC_SAMPLING - used as alternative to statistics for large-scale warehouse queries
    * OPT_PARAM - used to control optimizer behavior at query level (added in 10.2.0.3)
    * QB_NAME - specify query block name when tuning complex queries. It helps in finding a particular query for troubleshooting (10 and up)
    * CARDINALITY - give the optimizer better information 


ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

Oracle date format จัด format date ให้แสดง พศ และ เดือน ภาษาไทยหรือตามภาษาที่เราเลือก

java -Xms , java -Xmx กำหมด memory ให้ JVM เพื่อป้องกันปัญหา Out of Memory

Java this กับ super การใช้งานคำสั่ง this กับ super ใน ภาษา Java