Oracle Hint Usage

 

The correct syntax is:

select /*+ index(x idx_t) */ * from t x where x.object_id=123

/ * + * / And comments like, one more "+" than the comment, which is Hint

Above this hint it means when forced to take the index to make the implementation of the Oracle SQL.

 

If the syntax hint of an error, Oracle is not being given, but the / * * / comment as the contents of it.

 

Irrational use of hazardous Hint:

Since the data in the table will change, generally can not use Hint, Hint like the above as if forced to take the index in the program sql years. In case one day object_id = return results accounted for more than 50% of the full table of the 123, this time taking the index will be slower than the full table scan. It should not be mandatory in all cases take the index. Hint generally used for the first performance, such as for data extraction. Oracle and generally in 99% of cases will determine whether the correct index to go, we do not need to specify. Hint only to deal with under 1% of cases.

 

Append use:

 

append another Hint, general usage:

 

insert /*+ append */ into b select * from a;

 

This insert will be faster than the average insert a number, but the price is also large.

1. When the data table is delete, table space will leave a gap, it will go to fill the gap when the next insert. But append the insert does not find the gap, and added directly to the new space. If you have been using append, make the table space is growing.

2, this is more deadly, is to use the time to append, will lock the entire table, even if other users have to insert other data is blocked.

Therefore, production can not certainly append, append data extraction also work for a general class.

 

In fact, in most cases, not much use append efficiency.

Because of the fast append the reason is because of reduced log production.

 

Only the following scenarios will append log reduction generated:

1, non-archive mode

2, the filing mode, the state table is nologging

 

First, non-filing status is generally not possible, a little important point system must open the archive.

Archive mode nologging generally small, not a log, which means that you can restore the data is incomplete, it is risky.

 

Anyway, Hint applicable scenarios in fact very small, we know that there is such a thing, use the time to be cautious

reference:

https://www.cnblogs.com/attlia/p/3866593.html

Guess you like

Origin www.cnblogs.com/xiaohuizhenyoucai/p/11002242.html