Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: can anyone help me tune the database

Re: can anyone help me tune the database

From: Charles Hooper <hooperc2000_at_yahoo.com>
Date: 12 Sep 2006 04:38:01 -0700
Message-ID: <1158061081.351623.172270@i42g2000cwa.googlegroups.com>


trameshkumar_at_gmail.com wrote:

(Selective snipping):
> Top 5 Timed Events
> ~~~~~~~~~~~~~~~~~~
> % Total
> Event Waits Time (s)
> Ela Time
> -------------------------------------------- ------------ -----------
> --------
> CPU time 83
> 62.08
> direct path write 16,504 43
> 32.23
> db file sequential read 927 3
> 2.02
> db file scattered read 962 2
> 1.25
> control file parallel write 401 1
> 1.11
> CPU Elapsd
> Buffer Gets Executions Gets per Exec %Total Time (s) Time (s)
> Hash Value
> --------------- ------------ -------------- ------ -------- ---------
> ----------
> 1,461,109 1 1,461,109.0 89.4 45.95 47.73
> 2010239668
> begin Fspdf_Eod_Process_Pkg.FSPDFP_GEN_SALES_LEDGER_UPD(ip_compa
> ny_id_pk=>:ip_company_id_pk, ip_loggedin_id=>:ip_loggedin_id, Er
> rNumber=>:ErrNumber, ErrMessage=>:ErrMessage); end;

>

> 1,273,844 748 1,703.0 77.9 33.95 33.89
> 2933058741
> SELECT NVL(SUM(bldtls.debt_approved_amt),0), NVL(S
> UM(bldtls.debt_unapproved_amt),0) FROM BDS_BILL_
> DETAILS bldtls WHERE bldtls.company_id_pk = :b3
> AND bldtls.debtor_account_cd = :b2 AND TO_DATE(TO_CH
> AR(bldtls.bill_batch_date,'DD/MM/YYYY'),'DD/MM/YYYY') <= TO_DATE
>

> 65,183 1 65,183.0 4.0 1.02 1.39
> 96706093
> begin Fspdf_Eod_Process_Pkg.FSPDFP_RECOURSE_UNAPPROV_UPD(ip_comp
> any_id_pk=>:ip_company_id_pk, ip_loggedin_id=>:ip_loggedin_id, E
> rrNumber=>:ErrNumber, ErrMessage=>:ErrMessage); end;
>

> 53,164 519 102.4 3.3 1.55 1.60
> 3550942769
> SELECT NVL(SUM(invdtls.cl_approved_amt),0), NVL(SU
> M(invdtls.cl_unapproved_amt),0) FROM FCT_INV_DET
> AILS invdtls WHERE invdtls.company_id_pk = :b3
> AND invdtls.client_account_cd = :b2 AND TO_DATE(TO_CH
> AR(invdtls.inv_batch_date,'DD/MM/YYYY'),'DD/MM/YYYY') <= TO_DATE
>

> 46,758 322 145.2 2.9 0.53 0.71
> 4041023944
> SELECT invdtls.tran_id, invdtls.invoice_no, in
> vdtls.invoice_dn_flag, invdtls.debt_approved_amt FROM
> FCT_INV_DETAILS invdtls WHERE invdtls.company_
> id_pk = :b4 AND invdtls.client_account_cd = :b3 AND in
> vdtls.debt_approved_amt > 0 AND (TO_DATE(TO_CHAR(invdtls.du
>
> 40,913 1 40,913.0 2.5 1.58 4.38
> 4103447814
> BEGIN statspack.snap(i_snap_level=>10); END;
>

> 40,533 1 40,533.0 2.5 1.98 2.11
> 1428328184
> begin Fspdf_Eod_Process_Pkg.FSPDFP_LIMIT_EXP_CHECK_UPD(ip_compan
> y_id_pk=>:ip_company_id_pk, ip_loggedin_id=>:ip_loggedin_id, Err
> Number=>:ErrNumber, ErrMessage=>:ErrMessage); end;
>

> 39,282 1 39,282.0 2.4 1.52 1.60
> 555896067
> INSERT INTO TMP_INV_DEBT_APP_AMT_SUM (SELECT invdtl
> s.company_id_pk, invdtls.Debtor_Account_Cd, NVL(SUM(in
> vdtls.debt_approved_amt),0), NVL(SUM(invdtls.debt_unapprove
> d_amt),0) FROM FCT_INV_DETAILS invdtls WHERE i
> nvdtls.company_id_pk = :b2 AND TO_DATE(TO_CHAR(invdtls.inv_b
End
> value
> Parameter Name Begin value (if
> different)
> ----------------------------- ---------------------------------
> --------------
> processes 150
> db_cache_size 528482304
> compatible 9.2.0.0.0
> sort_area_size 524288
> pga_aggregate_target 39845888
> -------------------------------------------------------------
>

> End of Report
>

> Here is the full report .The End Of Day completed between the two snaps
> .Since direct path writes are more do I have to do anything related to
> pga_aggregate_target.
> Please help me .I am new to oracle .Any help will be greatly appreciated

Statspack reports... I try not to read them too often. Looking at the top SQL statements, it appears that this call to a PL/SQL function is the longest running, with one execution lasting 47.73 seconds, and with 1,461,109 logical reads (reading blocks from memory):
begin
  Fspdf_Eod_Process_Pkg.FSPDFP_GEN_SALES_LEDGER_UPD(     ip_company_id_pk=>:ip_company_id_pk,     ip_loggedin_id=>:ip_loggedin_id,
    ErrNumber=>:ErrNumber,
    ErrMessage=>:ErrMessage);
end;

The second longest running SQL statement, with 748 executions totaling 33.89 seconds, and 1,273,844 logical reads is likely in the above named PL/SQL function:
SELECT
   NVL(SUM(bldtls.debt_approved_amt),0),    NVL(SUM(bldtls.debt_unapproved_amt),0) FROM
   BDS_BILL_DETAILS bldtls
WHERE
   bldtls.company_id_pk = :b3
   AND bldtls.debtor_account_cd = :b2
   AND
TO_DATE(TO_CHAR(bldtls.bill_batch_date,'DD/MM/YYYY'),'DD/MM/YYYY') <= TO_DATE Take a look at
TO_DATE(TO_CHAR(bldtls.bill_batch_date,'DD/MM/YYYY'),'DD/MM/YYYY')

TRUNC(bldtls.bill_batch_date) will do the same task, and should consume less server CPU time. However, both TRUNC() and TO_DATE(TO_CHAR()) will make it impossible for Oracle to use an index on the bldtls.bill_batch_date column if one exists, unless there is a function based index on
TO_DATE(TO_CHAR(bldtls.bill_batch_date,'DD/MM/YYYY'),'DD/MM/YYYY'). Preferrably, you would rework this to take advantage of an index on bldtls.bill_batch_date without requiring a function based index.

How could this be rewritten? Assume that the full WHERE clause line looked like this:
  AND
TO_DATE(TO_CHAR(bldtls.bill_batch_date,'DD/MM/YYYY'),'DD/MM/YYYY') <= TO_DATE('01/02/2006','DD/MM/YYYY') This is functionally equivalent to the above, and will be able to use a normal index on the bldtls.bill_batch_date column:   AND bldtls.bill_batch_date < TO_DATE('01/02/2006')+1

You have sort_area_size at 524,288 B and pga_aggregate_target at 39,845,888 B. This sets the minimum value of the sort_area_size to 512KB, but that value can float upward, I believe to 5% (check Jonathan Lewis' Cost-Based Oracle Fundamentals book for the correct percentage) of 38MB (which ic roughly 1.9MB). Increasing the value of sort_area_size to 5MB and also increasing the pga_aggregate_target may decrease the sorts to disk, but fixing the SQL statement that I identified above may have a larger impact.

Charles Hooper
PC Support Specialist
K&M Machine-Fabricating, Inc. Received on Tue Sep 12 2006 - 06:38:01 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US