| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
|  |  | |||
Home -> Community -> Usenet -> c.d.o.tools -> Re: Tuning: indexes
Hi.
 It looks like you forgot some conditions in WHERE clause.
 Try the same statement with
  WHERE
b.bch_sref = a.sref AND b.sref = (select min(sref) from batch_item_tab where bch_sref = a.sref) AND c.bch_sref = a.sref AND c.sref = (select max(sref) from batch_item_tab where bch_sref =a.sref);
Please post the results.
HTH. Michael
In article <B5750F65.4B82%manoj_at_mac.com>,
  manoj_at_mac.com wrote:
> Hello,
>
> Can anyone help me with ideas on tuning this query? See explain plan
 below..
> Its extremely slow.
>
> CREATE OR REPLACE VIEW BATCH_PERSONAL
> (
>     SREF,
>     OREF,
>     DATE_TRANSACTION,
>     ACT_SREF,
>     ACT_CODE,
>     ACT_NAME,
>     PRD_SREF,
>     PRD_CODE,
>     PRD_NAME,
>     NOTE,
>     SIDE1_SREF,
>     SIDE1_ACC_SREF,
>     SIDE1_ACC_NAME,
>     SIDE1_DEBIT,
>     SIDE1_CREDIT,
>     SIDE2_SREF,
>     SIDE2_ACC_SREF,
>     SIDE2_ACC_NAME,
>     SIDE2_DEBIT,
>     SIDE2_CREDIT,
>     CODE,
>     DRAFT,
>     ACC_TYP_TYP_SREF,
>     ACC_TYP_TYP_CODE,
>     ACC_TYP_TYP_NAME,
>     SIDE2_MEMO
> )
> AS
> select a.sref, a.oref, a.date_transaction,
> a.act_sref, a.act_code, a.act_name,
> a.prd_sref, a.prd_code, a.prd_name,
> a.note,
> fld(get_srefs(a.sref ), ',',1) side1_sref,
> to_char(b.acc_sref) side1_acc_sref,
> b.acc_name side1_acc_name,
> decode(b.dc,'D',b.amount,0) side1_debit,
> decode(b.dc,'C',b.amount,0) side1_credit,
> fld(get_srefs(a.sref),',',2) side2_sref,
> to_char(c.acc_sref) side2_acc_sref,
> c.acc_name side2_acc_name,
> decode(c.dc,'D',b.amount,0) side2_debit,
> decode(c.dc,'C',b.amount,0) side2_credit,
> a.code,draft,a.acc_typ_typ_sref,a.acc_typ_typ_code,
 a.acc_typ_typ_name,
> c.item_description
> from batch_tab a, batch_item_tab b, batch_item_tab c
> where b.sref = (select min(sref) from batch_item_tab where bch_sref =
> a.sref)
>  and c.sref = (select max(sref) from batch_item_tab where bch_sref =
> a.sref);
> QUERY_PLAN
> ----------------------------------------------------------------------
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Wed Jun 21 2000 - 00:00:00 CDT
|  |  |