[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Query tuning problem

Asked by chedgey in Oracle Database

Tags: query

I have recently upgraded a third party application from Oracle 8.1.6 to Oracle 9.2.0.7.0 and all is well apart from a couple of queries that are running poorly. The queries are based on a simple view and I am having problems seeing why the cost based optimiser is behaving as it is with it.

When i run the uderlying query of the view as a SQL statement it gives me a high cost but if I strip out the column list (keeping the rest of the query consitent) it behaves much better. Here are the plans from the 2 versions of the query:

Original Query
----------------
Explain Plan
Set STATEMENT_ID='GJC3'
For
SELECT IF_.R_OBJECT_ID,IF_.OBJECT_NAME
      ,IF_.R_OBJECT_TYPE,IF_.TITLE
      ,IF_.SUBJECT,IF_.A_APPLICATION_TYPE
      ,IF_.A_STATUS,IF_.R_CREATION_DATE,IF_.R_MODIFY_DATE,IF_.R_MODIFIER
      ,IF_.R_ACCESS_DATE,IF_.A_IS_HIDDEN,IF_.I_IS_DELETED,IF_.A_RETENTION_DATE
      ,IF_.A_ARCHIVE,IF_.A_COMPOUND_ARCHITECTURE,IF_.A_LINK_RESOLVED,IF_.I_REFERENCE_CNT
      ,IF_.I_HAS_FOLDER,IF_.R_LINK_CNT,IF_.R_LINK_HIGH_CNT,IF_.R_ASSEMBLED_FROM_ID
      ,IF_.R_FRZN_ASSEMBLY_CNT,IF_.R_HAS_FRZN_ASSEMBLY,IF_.I_CONTENTS_ID,IF_.A_CONTENT_TYPE,IF_.R_PAGE_CNT
      ,IF_.R_CONTENT_SIZE,IF_.A_FULL_TEXT,IF_.A_STORAGE_TYPE,IF_.I_CABINET_ID
      ,IF_.OWNER_NAME,IF_.OWNER_PERMIT,IF_.GROUP_NAME,IF_.GROUP_PERMIT,IF_.WORLD_PERMIT,IF_.I_ANTECEDENT_ID,IF_.I_CHRONICLE_ID,IF_.I_LATEST_FLAG,IF_.R_LOCK_OWNER,IF_.R_LOCK_DATE,IF_.R_LOCK_MACHINE,IF_.LOG_ENTRY,IF_.I_BRANCH_CNT,IF_.I_DIRECT_DSC,IF_.R_IMMUTABLE_FLAG,IF_.R_FROZEN_FLAG,IF_.R_HAS_EVENTS,IF_.ACL_DOMAIN,IF_.ACL_NAME,IF_.A_SPECIAL_APP,IF_.DOCUMENT_NUMBER,IF_.DOCUMENT_DATE,IF_.ISSUE_LEVEL
      ,IF_.I_IS_REFERENCE
      ,IF_.RESOLUTION_LABEL
      ,IF_.R_IS_VIRTUAL_DOC
      ,IF_.R_IS_PUBLIC
      ,IF_.R_CREATOR_NAME
      ,IF_.R_POLICY_ID
      ,IF_.R_RESUME_STATE
      ,IF_.R_CURRENT_STATE
      ,IF_.R_ALIAS_SET_ID
      ,IF_.I_IS_REPLICA
      ,IF_.A_CATEGORY
      ,IF_.LANGUAGE_CODE
      ,IF_.I_VSTAMP
      ,UY_.DCA_IDENTIFIER
      ,UY_.DCA_CURRENT_STATUS
      ,UY_.DCA_PROJECT
      ,UY_.DCA_DATE_OPENED
      ,UY_.DCA_DESCRIPTION
      ,UY_.DCA_FORMAL
      ,UY_.DCA_WORKFLOW_ID
      ,UY_.DCA_SUBMITTED
      ,UY_.DCA_DESTINATION
      ,UY_.DCA_PUBLISHING_INFO
      ,UY_.DCA_LOCKOWNER
      ,UY_.DCA_REJECTION_NOTES
      ,UY_.DCA_FINALISED_DATE
      ,UY_.DCA_FORMAL_START_DATE
      ,UY_.ACTIVE_REVIEWERS
  FROM LMREDMS.dm_sysobject_s IF_
      ,LMREDMS.lm_dca_s UY_
 WHERE IF_.R_OBJECT_ID=UY_.R_OBJECT_ID
/

Query Plan                                                                      
--------------------------------------------------------------------------------
1.33774 SELECT STATEMENT    GJC3 Cost=33774                                    
--2.1 HASH JOIN                                                                
  --3.1 TABLE ACCESS FULL LM_DCA_S                                              
  --3.2 TABLE ACCESS FULL DM_SYSOBJECT_S                                        


Column list removed
-----------------------
Explain Plan
Set STATEMENT_ID='GJC3'
For
SELECT IF_.R_OBJECT_ID
      ,UY_.R_OBJECT_ID
  FROM LMREDMS.dm_sysobject_s IF_
      ,LMREDMS.lm_dca_s UY_
 WHERE IF_.R_OBJECT_ID=UY_.R_OBJECT_ID
/
Query Plan                                                                      
--------------------------------------------------------------------------------
1.289 SELECT STATEMENT    GJC3 Cost=289                                        
--2.1 NESTED LOOPS                                                              
  --3.1 INDEX FAST FULL SCAN D_1F004421800001A1 UNIQUE                          
  --3.2 INDEX UNIQUE SCAN D_1F00442180000108 UNIQUE                            


Can anyone tell me why the first query with all the columns listed takes so much longer than the second. All tables are analyzed and the optimizer rule is set to "Choose. The DM_SYSOBJECTS_S table contains about 1,600,000 rows and the LM_DCA_S table about 33,000. Both tables have an index on the R_OBJECT_ID column

Thanks in advance

Chedgey
[+][-]09/18/06 06:57 AM, ID: 17543519Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Oracle Database
Tags: query
Sign Up Now!
Solution Provided By: johnsone
Participating Experts: 2
Solution Grade: C
 
[+][-]09/18/06 04:48 AM, ID: 17542534Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09/21/06 06:57 AM, ID: 17569115Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92