Wednesday, November 30, 2011

Hints in oracle


  • ALL_ROWS
    One of the hints that 'invokes' the
    Cost based optimizer
    ALL_ROWS is usually used for batch processing or data warehousing systems.

(/*+ ALL_ROWS */) 

  • FIRST_ROWS
    One of the hints that 'invokes' the
    Cost based optimizer
    FIRST_ROWS is usually used for OLTP systems.

(/*+ FIRST_ROWS */) 

  • CHOOSE
    One of the hints that 'invokes' the
    Cost based optimizer
    This hint lets the server choose (between ALL_ROWS and FIRST_ROWS, based on
    statistics gathered.
  • HASH
    Hashes one table (full scan) and creates a hash index for that table. Then hashes other table and uses hash index to find corresponding records. Therefore not suitable for < or > join conditions.

/*+ use_hash */

Hints are most useful to optimize the query performance.

1 comment: