Quantcast
Viewing all articles
Browse latest Browse all 2539

Re: How to get good statistics on a initially empty table?

Hi Jens,

 

you could use the HINT ORDERED in Join environment.

With this hint you can define the order in which the tables are processed ( T00/T01/T02) but you have to change the Join syntax as follows:

SELECT /*+ORDERED */

  DISTINCT  T_01 . "C5" "EXTRACTKEY" , T_00 . "DEVID" "DEVID"

FROM

  "RR00K00G03X_DQ" T_00 , "ZDOE00G03702" T_01, "ZDOE00G03X00" T_02

WHERE
T_01 . "CLIENT" = ? AND T_01 . "EXTRACTKEY  " = T_00 . "INSID"

AND

T_02 . "CLIENT" = ? AND T_02 . "EXTRACTKEY" = T_01 . "C5"

AND

  T_00 . "CLIENT" = ? AND T_00 . "SEQNO" IN ( ? , ? , ? , ? , ? )

 

But then this statement is always executed with the EXPLAIN plan independant from the values in the Qualification. So it could happen that depending on the Where qualification values a worse strategy is used.

 

You avoid the cost based optimizer.

 

Better would be to create a customer owned FORM-Routine with Native SQL which concatenates the update statistics command for the tables and executed

 

 

 

 


concatenate 'UPDATE STAT "'l_tablnm'" ESTIMATE'
into l_stmt.

Execute the created update statistics table command

concatenate

'UPDATE STAT COLUMN(*) FOR "'l_tablnm'" ESTIMATE'
into l_stmt.

 

 

==> Update Statistics column is important for the JOIN !!!

Regards, Christiane

 

 




 


Viewing all articles
Browse latest Browse all 2539

Trending Articles