Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Slow running Query.
Content-Type: Text/Plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi, =0D
First try to get statistics use the =0D
EXEC DBMS_UTILITY.ANALYZE_SCHEMA('ADM','COMPUTE'); package=0D
and try again=0D
=0D
If not work send me to my mail an export from all the tables and the quer=
y
you have.=0D
I will get it work in 9i changing cbo features to 8i (I don't have 8i)
specify the release you use=0D
=0D
Maybe you could be having other problems withthe =0D
=0D
DB_FILE_MULTIBLOCK_READ_COUNT parameter=0D
inlcude there the ini.ora file=0D
=0D
-------Original Message-------=0D
=0D
From: oracle-l_at_freelists.org=0D
Date: 06/25/04 12:38:27=0D
To: oracle-l_at_freelists.org=0D
Subject: RE: Slow running Query.=0D
=0D
Juan,=0D
I did try the original query with session mode set to 'CHOOSE'.=0D
Here is the results.=0D
=0D
SQL> alter session set optimizer_mode=3D3D'CHOOSE';=0D
=0D
=0D
OPERATION OPTIONS OBJECT_NAME =
------------------------- ------------------------- -------------------- =--=3D=0D
SELECT STATEMENT =
SORT AGGREGATE =
=3D=0D
1=0D HASH JOIN =
=3D=0D
1=0D VIEW ASSETS_VIEW =
=3D=0D
1=0D SORT GROUP BY =
=3D=0D
1=0D TABLE ACCESS FULL ME_CLIENT_ASSETS =
=3D=0D
1=0D HASH JOIN =
=3D=0D
2=0D TABLE ACCESS FULL PERFCLIENT =
=3D=0D
1=0D TABLE ACCESS BY INDEX ROWID CLIENT =
=3D=0D
2=0D INDEX RANGE SCAN CL_DECMKR_IDX =
=3D=0D
1=0D
OPERATION OPTIONS OBJECT_NAME =
------------------------- ------------------------- -------------------- =--=3D=0D
SORT AGGREGATE =
=3D=0D
1=0D NESTED LOOPS =
=3D=0D
1=0D NESTED LOOPS =
=3D=0D
1=0D VIEW ASSETS_VIEW =
=3D=0D
1=0D SORT GROUP BY =
=3D=0D
1=0D TABLE ACCESS FULL ME_CLIENT_ASSETS =
=3D=0D
1=0D TABLE ACCESS BY INDEX ROWID CLIENT =
=3D=0D
2=0D INDEX UNIQUE SCAN CLIENT_IDX =
=3D=0D
1=0D TABLE ACCESS BY INDEX ROWID PERFCLIENT =
=3D=0D
2=0D INDEX RANGE SCAN PC_CLCODE_IDX =
=3D=0D
1=0D
OPERATION OPTIONS OBJECT_NAME =
------------------------- ------------------------- -------------------- =--=3D=0D
SELECT STATEMENT =
HASH JOIN =
=3D=0D
1=0D TABLE ACCESS BY INDEX ROWID CLIENT =
=3D=0D
1=0D INDEX RANGE SCAN CL_DECMKR_IDX =
=3D=0D
1=0D TABLE ACCESS FULL ME_CLIENT_ASSETS =
=3D=0D
2=0D
OPERATION OPTIONS OBJECT_NAME =
------------------------- ------------------------- -------------------- =--=3D=0D
NESTED LOOPS =
=3D=0D
1=0D TABLE ACCESS BY INDEX ROWID CLIENT =
=3D=0D
1=0D INDEX RANGE SCAN CL_DECMKR_IDX =
=3D=0D
1=0D TABLE ACCESS BY INDEX ROWID ME_CLIENT_ASSETS =
=3D=0D
2=0D INDEX RANGE SCAN PK_ME_CLIENT_ASSETS =
=3D=0D
1=0D
OPERATION OPTIONS OBJECT_NAME ==3D3D=0D
------------------------- ------------------------- --------------------=0D----------=3D3D0D=0D
NESTED LOOPS ==3D3D=0D
1=3D3D0D=0D TABLE ACCESS BY INDEX ROWID CLIENT ==3D3D=0D
1=3D3D0D=0D INDEX RANGE SCAN CL_DECMKR_IDX ==3D3D=0D
1=3D3D0D=0D TABLE ACCESS BY INDEX ROWID ME_CLIENT_ASSETS ==3D3D=0D
2=3D3D0D=0D INDEX RANGE SCAN PK_ME_CLIENT_ASSETS ==3D3D=0D
1=3D3D0D=0D
=3D3D0D=0D
Now as you can see that this query uses the index PK_ME_CLIENT_ASSETS=0D
despited the query clause=3D3D0D=0D
substr(ca_date,1,4)||substr(ca_date,6,2)=3D3D3D'20012=3D3D0D=0D
=3D3D0D=0D
So it seems to me as if original query does use the required index becaus=
=3D3D=0D
e=0D
of the definition of View assets_view.=3D3D0D=0D
=3D3D0D=0D
I am attaching with following file, if someone is interested in doing som=
=3D3D=0D
e=0D
test.=3D3D0D=0D
1. create_schema.sql ( will create required tables and view).=3D3D0D=0D
2. drop_schema.sql ( will drop all the objects created by above script).=3D=
3D=3D=0D
0D=0D
3. q1.sql ( My original query based on view, which does not use required=0D
Index)=3D3D0D=0D
4. q2.sql (The above query where I use substr(column) in the where clause=
=3D3D=0D
,=0D
but still used Index).=3D3D0D=0D
=3D3D0D=0D
Anyway thanks for all of you who provided your valuable inputs.=3D3D0D=0D
=3D3D0D=0D
=3D3D0D=0D
=3D3D0D=0D
-----Original Message-----=3D3D0D=0D
From: oracle-l-bounce_at_freelists.org=3D3D0D=0D
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Wolfgang Breitling=3D3=
D0D=0D
Sent: June 22, 2004 7:10 PM=3D3D0D=0D
To: oracle-l_at_freelists.org=3D3D0D=0D
Subject: RE: Slow running Query.=3D3D0D=0D
=3D3D0D=0D
=3D3D0D=0D
How many cl_clcodes does the subselect return and how does that number=3D=
3D0D=0D
compare to the cardinality of the VW_NSO_1 view in the explain plan?=3D3D=
0D=0D
=3D3D0D=0D
At 11:03 AM 6/22/2004, you wrote:=3D3D0D=0D
>Mark,=3D3D0D=0D
>I tried both the options suggested by you. Following is the result.=3D3D=
0D=0D
>=3D3D0D=0D >Thought 1.=3D3D0D=0D >Query=3D3D0D=0D >=3D3D0D=0D >SELECT sum(nvl(as_ofcsh,0)),sum(nvl(as_offxd,0)),=3D3D0D=0D > sum(nvl(as_ofeqty,0)),sum(nvl(as_ofai,0))=3D3D0D=0D > FROM assets_view=3D3D0D=0D > WHERE as_clcode in ( select cl_clcode from perfclient,client=3D= 3D0D=0D > WHERE cl_decmkr=3D3D3D3D'64501013'=3D3D= 0D=0D > AND cl_clcode=3D3D3D3Dpc_clcode=3D3D0D=0D > AND pc_prfcomb in ('B', 'Y')=3D3D0D=0D > AND pc_grpdte !=3D3D3D '0000-00-00' -- =dkum=3D=0D
> AND=3D3D0D=0D > substr(pc_grpdte,1,4)||substr(pc_grpdte,6,2) <=3D3D3D '200312')=3D3D0D=0D > and as_date =3D3D3D'200312'=3D3D0D=0D
----------------------------------------------------------------=3D3D0D=0DPlease see the official ORACLE-L FAQ: http://www.orafaq.com=3D3D0D=0D
----------------------------------------------------------------=3D3D0D=0DTo unsubscribe send email to: oracle-l-request_at_freelists.org=3D3D0D=0D put 'unsubscribe' in the subject line.=3D3D0D=0D --=3D3D0D=0D
-----------------------------------------------------------------=3D3D0D=0D
1>***********************************************************************==3D3D=0D
-- Binary/unsupported file stripped by Ecartis --=3D3D0D=0D -- Type: application/octet-stream=3D3D0D=0D -- File: create_schema.sql=3D3D0D=0D -- Desc: create_schema.sql=3D3D0D=0D
-- Binary/unsupported file stripped by Ecartis --=3D3D0D=0D -- Type: application/octet-stream=3D3D0D=0D -- File: drop_schema.sql=3D3D0D=0D -- Desc: drop_schema.sql=3D3D0D=0D
-- Binary/unsupported file stripped by Ecartis --=3D3D0D=0D -- Type: application/octet-stream=3D3D0D=0D -- File: q1.sql=3D3D0D=0D -- Desc: q1.sql=3D3D0D=0D
-- Binary/unsupported file stripped by Ecartis --=3D3D0D=0D -- Type: application/octet-stream=3D3D0D=0D -- File: q2.sql=3D3D0D=0D -- Desc: q2.sql=3D3D0D=0D
----------------------------------------------------------------=3D3D0D=0DPlease see the official ORACLE-L FAQ: http://www.orafaq.com=3D3D0D=0D
----------------------------------------------------------------=3D3D0D=0DTo unsubscribe send email to: oracle-l-request_at_freelists.org=3D3D0D=0D put 'unsubscribe' in the subject line.=3D3D0D=0D --=3D3D0D=0D
-----------------------------------------------------------------=0D=0D
-- Binary/unsupported file stripped by Ecartis --=0D -- Type: image/gif=0D -- File: IMSTP.gif=0D
----------------------------------------------------------------=0DPlease see the official ORACLE-L FAQ: http://www.orafaq.com=0D
----------------------------------------------------------------=0DTo unsubscribe send email to: oracle-l-request_at_freelists.org=0D put 'unsubscribe' in the subject line.=0D --=0D
-----------------------------------------------------------------=0D=0D
<FONT SIZE =3D3D 1>******************************************************=****=3D=0D
******************=0D
----------------------------------------------------------------=0DPlease see the official ORACLE-L FAQ: http://www.orafaq.com=0D
----------------------------------------------------------------=0DTo unsubscribe send email to: oracle-l-request_at_freelists.org=0D put 'unsubscribe' in the subject line.=0D --=0D
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Fri Jun 25 2004 - 11:53:12 CDT
![]() |
![]() |