Oracle: hint of usage

  1. / + ALL_ROWS /
      show selection of the statement block cost-based optimization method, and get the best throughput, so that resource consumption is minimized.
      For example:
      the SELECT / + + ALL _ROWS / EMP_NO, EMP_NAM, the WHERE DAT_IN the FROM BSEMPMS EMP_NO = 'SCOTT' ;
      
      2. / + the FIRST_ROWS /
      show selection of the statement block cost-based optimization method, and get the best response time, so that resource consumption is minimized.
      for example:
      the sELECT / + the FIRST_ROWS / EMP_NO, EMP_NAM, the WHERE DAT_IN the FROM BSEMPMS EMP_NO = 'SCOTT ';

3. / + CHOOSE /
  show if there is access to the statistics table of the data dictionary, the cost-based optimization method, and get the best throughput;
  indicate if the data is not in the dictionary table statistical information access, rule-based overhead optimization method;
  for example:
  the SELECT / + the CHOOSE / EMP_NO, EMP_NAM, the WHERE DAT_IN the FROM BSEMPMS EMP_NO = 'SCOTT';

4. / + the RULE /
  show statement block pair selection rule-based optimization method.
  For example:
  the SELECT / * + the RULE * / EMP_NO, EMP_NAM, the WHERE DAT_IN the FROM BSEMPMS EMP_NO = 'SCOTT';

5. The / + FULL (TABLE) /
  show selection method on the table of the global scanning.
  For example:
  the SELECT / + FULL (A) / EMP_NO, the WHERE EMP_NAM the FROM A BSEMPMS EMP_NO = 'SCOTT';

6. The / + the ROWID (TABLE) /
  prompt clear that according to the specified table access ROWID.
  For example:
  the SELECT / + the ROWID (BSEMPMS) / * the FROM BSEMPMS the WHERE the ROWID> = 'AAAAAAAAAAAAAA'
  the AND EMP_NO = 'SCOTT';

7. The / + the CLUSTER (TABLE) /
  Tip clear that the access method for the specified cluster scan table selection, is only effective for cluster objects.
  For example:
  the SELECT / * + * the CLUSTER / BSEMPMS.EMP_NO, DPT_NO the FROM BSEMPMS, BSDPTMS
  the WHERE DPT_NO = 'TEC304' AND BSEMPMS.DPT_NO = BSDPTMS.DPT_NO;

8. The / + the INDEX (TABLE INDEX_NAME is) /
  show scanning method for selecting the index table.
  For example:
  the SELECT / * + the INDEX (BSEMPMS SEX_INDEX) the USE SEX_INDEX BECAUSE THERE the ARE FEWMALE BSEMPMS * / the FROM BSEMPMS the WHERE SEX = 'M';

9. The / + INDEX_ASC (TABLE INDEX_NAME is) /
  show an index table scan method is selected in ascending order.
  For example:
  the SELECT / * + INDEX_ASC (BSEMPMS PK_BSEMPMS) * / = DPT_NO the FROM BSEMPMS the WHERE 'SCOTT';

10. The / + INDEX_COMBINE /
  specified bitmap table access path selection, if not provided as INDEX_COMBINE index parameter of the selected bit Boolean combinations FIG index.
  For example:
  the SELECT / + INDEX_COMBINE (BSEMPMS SAL_BMI HIREDATE_BMI) / * BSEMPMS the FROM
  the WHERE SAL <HIREDATE the AND 5000000

11. The / + INDEX_JOIN (TABLE INDEX_NAME is) /
  prompt command explicitly optimization index as the access path is used.
  For example:
  the SELECT / + INDEX_JOIN (BSEMPMS SAL_HMI HIREDATE_BMI) / SAL, HIREDATE
  the FROM BSEMPMS the WHERE SAL <60000;

12. The / + INDEX_DESC (TABLE INDEX_NAME is) /
  show an index table scan method is selected in descending order.
  For example:
  the SELECT / * + INDEX_DESC (BSEMPMS PK_BSEMPMS) * / = DPT_NO the FROM BSEMPMS the WHERE 'SCOTT';

13. / + INDEX_FFS (TABLE INDEX_NAME is) /
  perform the specified table index fast full scan, rather than a full table scan approach.
  For example:
  the SELECT / + INDEX_FFS (BSEMPMS IN_EMPNAM) / * the FROM BSEMPMS the WHERE DPT_NO = 'TEC305';

14. The / + ADD_EQUAL TABLE INDEX_NAM1, INDEX_NAM2, ... /
  prompts to select a clear plan of execution, several separate index scan together.
  For example:
  the SELECT / + INDEX_FFS (BSEMPMS IN_DPTNO, IN_EMPNO, IN_SEX) / * the FROM BSEMPMS the WHERE EMP_NO = 'SCOTT' AND DPT_NO = ' TDC306';

15. A / + USE_CONCAT /
  on the back of the OR WHERE query is converted to a combination of conditions UNION ALL query.
  For example:
  the SELECT / + USE_CONCAT / * WHERE DPT_NO the FROM BSEMPMS = 'TDC506' the AND SEX = 'M';

16. A / + NO_EXPAND /
  for the latter OR WHERE query or the IN-LIST, NO_EXPAND based optimizer will prevent its expansion.
  For example:
  the SELECT / + NO_EXPAND / * WHERE DPT_NO the FROM BSEMPMS = 'TDC506' = the AND SEX 'M';

17. A / + NOWRITE /
  disables the query block query rewrite operation.

18. A / + the REWRITE /
  view can be used as parameters.

19. A / + the MERGE (TABLE) /
  can be combined for each corresponding query views.
  For example:
  the SELECT / the MERGE + * (V) * / A.EMP_NO, A.EMP_NAM, B.DPT_NO BSEMPMS the FROM A (selet DPT_NO
  , the AVG (SAL) the FROM BSEMPMS the AS AVG_SAL the GROUP BY DPT_NO B) V = V.DPT_NO the WHERE A.DPT_NO
  the AND A.SAL> V.AVG_SAL;

20. A / + The NO_MERGE (TABLE) /
  to be combined with a view not combined.
  For example:
  the SELECT / * + The NO_MERGE (V) * / A.EMP_NO, A.EMP_NAM, B.DPT_NO BSEMPMS the FROM A (the SELECT DPT_NO, the AVG (SAL) AS AVG_SAL FROM BSEMPMS B GROUP BY DPT_NO) V WHERE A.DPT_NO = V.DPT_NO AND A.SAL> V.AVG_SAL;

21. A / + the ORDERED /
  the order table appears in the FROM, ORDERED ORACLE this order so that their connection.
  For example:
  the SELECT / + the ORDERED / A.COL1, B.COL2, C.COL3 TABLE1 FROM A, B TABLE2, tABLE3 C WHERE A.COL1 = B.COL1 AND B.COL1 = C.COL1;

22. A / + USE_NL (TABLE) /
  the specified table with the row connecting a source connected nested, and specifies the table as an internal table.
  For example:
  the SELECT / + the ORDERED USE_NL (BSEMPMS) / BSDPTMS.DPT_NO, BSEMPMS.EMP_NO, BSEMPMS.EMP_NAM FROM BSEMPMS, BSDPTMS WHERE BSEMPMS.DPT_NO = BSDPTMS.DPT_NO;

23. A / + USE_MERGE (TABLE) /
  specified source table with other rows are connected by connection merge sort together.
  For example:
  the SELECT / + USE_MERGE (BSEMPMS, BSDPTMS) / * BSEMPMS the FROM, the WHERE BSEMPMS.DPT_NO BSDPTMS = BSDPTMS.DPT_NO ;

24. A / + USE_HASH (TABLE) /
  specified source table with other rows are connected by way hash join together.
  For example:
  the SELECT / + USE_HASH (BSEMPMS, BSDPTMS) / * BSEMPMS the FROM, the WHERE BSEMPMS.DPT_NO BSDPTMS = BSDPTMS.DPT_NO ;

25. A / + DRIVING_SITE (TABLE) /
  forced ORACLE location different from the selected table query execution.
  For example:
  the SELECT / + DRIVING_SITE (the DEPT) / * BSEMPMS the FROM, the DEPT @ BSDPTMS the WHERE BSEMPMS.DPT_NO = DEPT.DPT_NO;

26. A / + LEADING (TABLE) /
  specified in the order table as the first connection table.

27. A / + the CACHE (TABLE) /
  when a full table scan, CACHE prompted to retrieve the block table can be placed in the buffer cache LRU list of recently used LRU end
  , for example:
  the SELECT / * + FULL (BSEMPMS) CAHE ( BSEMPMS) * / EMP_NAM FROM BSEMPMS;

28. A / + the NOCACHE (TABLE) /
  when a full table scan, CACHE prompted to retrieve the block table can be placed in the buffer cache LRU list of recently used LRU end
  , for example:
  the SELECT / * + FULL (BSEMPMS) NOCAHE ( BSEMPMS) * / EMP_NAM FROM BSEMPMS;

29. A / + the APPEND /
  . Directly into the end of the table, can improve the speed
  INSERT / + the append / INTO test1 SELECT * from Test4;

30. A / + NOAPPEND /
  by stopping the parallel mode in the insert statement to start the lifetime of a conventional insert.
  INSERT / + NOAPPEND / INTO test1 SELECT * from Test4;

发布了58 篇原创文章 · 获赞 5 · 访问量 5091

Guess you like

Origin blog.csdn.net/weixin_42161670/article/details/103165295