Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: ANALYZE command question.
Dana Stockler wrote:
>
> I am periodically running a batch job that dynamically
> generates and executes a script which executes the
> ANALYZE command on all of the tables in the database
> (except user SYS% tables).
>
> The command executed is:
>
> analyze table <tablename> compute statistics ;
>
> Is this enough to allow the cost-based query optimizer
> to do it's job well enough? Or should I be using one of the
> 'for' clauses?
For the optimizer to use cost-based, you need to set the OPTIMIZER_GOAL or OPTIMIZER_MODE to be cost-based such as ALL_ROWS.
Analyze table will analyze the assoicated index. Thus, it is enough if the tables involved in the query have been analyzed.
--- Name : Lun Wing San (Certified Oracle Database Administrator) Title : Oracle Application Developer of Hong Kong Productivity Council Oracle Database Administrator and System Administrator of QRC Phone : (852)27885841 This posting represents the personal opinions of the author. It is not the official opinion or policy of the author's employer. Warranty expired when you opened this article and I will not be responsible for its contents or use.Received on Tue Mar 04 1997 - 00:00:00 CST