Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-10-28 : 08:32:01
|
dps writes "Can someone suggest a boost to this.select count(rowid) from accountCOUNT(ROWID)------------ 33706select count(rowid) from tel_nosCOUNT(ROWID)------------ 4121532from account a, tel_nos twhere t.tel_type = 'S'AND SYSDATE BETWEEN t.start_date AND NVL(t.end_date, SYSDATE)and rownum < 1001and t.rowid <> a.rowidOPERATION OPTIONS OBJECT_NAMESELECT STATEMENTCOUNT STOPKEYNESTED LOOPSTABLE ACCESS FULL TEL_NOSTABLE ACCESS FULL ACCOUNTExecution Plan 0 SELECT STATEMENT Optimizer=CHOOSE 1 0 FILTER 2 1 CONNECT BY 3 2 TABLE ACCESS (FULL) OF 'PLAN_TABLE' 4 2 TABLE ACCESS (BY USER ROWID) OF 'PLAN_TABLE' 5 2 TABLE ACCESS (FULL) OF 'PLAN_TABLE'If I take off tel_type then its slightly quicker.Table detailstel_nos------TEL_ID NOT NULL NUMBER(10)TEL_TYPE NOT NULL VARCHAR2(10)TEL_NO NOT NULL VARCHAR2(19)SITE_USAGE_ID VARCHAR2(10) PROSPECT_ID VARCHAR2(14) START_DATE DATEEND_DATE DATE-----------------INDEX_TYPE : NORMALINDEX_NAME : IFL07UNIQUENESS : NONUNIQUECOLUMN_NAME : CONTACT_SEQCOLUMN_POSITION : 1-----------------INDEX_TYPE : NORMALINDEX_NAME : IFL08UNIQUENESS : NONUNIQUECOLUMN_NAME : EQUIPMENT_INSTANCE_IDCOLUMN_POSITION : 1-----------------INDEX_TYPE : NORMALINDEX_NAME : IFL09UNIQUENESS : NONUNIQUECOLUMN_NAME : PROSPECT_IDCOLUMN_POSITION : 1-----------------INDEX_TYPE : NORMALINDEX_NAME : IFL10UNIQUENESS : NONUNIQUECOLUMN_NAME : SITE_USAGE_IDCOLUMN_POSITION : 1INDEX_TYPE : NORMALINDEX_NAME : PI17UNIQUENESS : NONUNIQUECOLUMN_NAME : PROSPECT_IDCOLUMN_POSITION : 1-----------------INDEX_TYPE : NORMALINDEX_NAME : PI17UNIQUENESS : NONUNIQUECOLUMN_NAME : SITE_USAGE_IDCOLUMN_POSITION : 2-----------------INDEX_TYPE : NORMALINDEX_NAME : PI17UNIQUENESS : NONUNIQUECOLUMN_NAME : CONTACT_SEQCOLUMN_POSITION : 3-----------------INDEX_TYPE : NORMALINDEX_NAME : PI17UNIQUENESS : NONUNIQUECOLUMN_NAME : TEL_TYPECOLUMN_POSITION : 4-----------------INDEX_TYPE : NORMALINDEX_NAME : PL03UNIQUENESS : UNIQUECOLUMN_NAME : TEL_IDCOLUMN_POSITION : 1-----------------INDEX_TYPE : NORMALINDEX_NAME : TEL_INDUNIQUENESS : NONUNIQUECOLUMN_NAME : TEL_NOCOLUMN_POSITION : 1-----------------INDEX_TYPE : NORMALINDEX_NAME : UN06UNIQUENESS : UNIQUECOLUMN_NAME : TEL_NOCOLUMN_POSITION : 1-----------------INDEX_TYPE : NORMALINDEX_NAME : UN06UNIQUENESS : UNIQUECOLUMN_NAM |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-10-28 : 08:38:39
|
Two things:A. We're not an Oracle site, we focus on SQL Server. You might get a better answer in an Oracle forum.B. The statement you posted:from account a, tel_nos t where t.tel_type = 'S' AND SYSDATE BETWEEN t.start_date AND NVL(t.end_date, SYSDATE) and rownum < 1001 and t.rowid <> a.rowid...is a CROSS JOIN between the two tables, effectively generating close to 138,920,357,592 rows of data. I'm not well-versed in how Oracle optimizes its queries but that could very well be part of your problem. I do know that it used to be extremely fussy about how the parts of the WHERE clause were ordered, and that moving conditions around would generate completely different execution plans, you might want to give that a try if you haven't already. |
|
|
|
|
|
|
|