Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 426739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:30:34+00:00 2026-05-12T19:30:34+00:00

I have a query which part of a SP which is executed fairly regularly,

  • 0

I have a query which part of a SP which is executed fairly regularly, and the query took a while to execute, so I decided to have a look at it. I did an autotrace on the query, and this was the execution plan returned [ pasted in pastebin due to excessive size ]

I added indexes on the tables which was undergoing full table access, and ran the query. The query performance was worse then before, despite the cost being significantly lower.

Why is this so, can anyone shed a light on the same ?

The database is an Oracle 10gR2 ( Release 10.2.0.1.0 ).

This is the query being run

SELECT DISTINCT CAC_FLEX_03, CAC_FLEX_04
        FROM PCOM_CUST_PRACTICE_INFO A,
             PGIM_ZIP_CODES          C,
             PGIM_PROD_TARIFF_DATA   B,
             PCOM_CODES_APPL_CODES   D
       WHERE A.PCPI_CUST_CODE IN ('002023', '002025')
         AND C.ZC_ZIP_CODE = A.PCPI_PIN_CODE
         AND C.ZC_CITY_CODE = A.PCPI_CITY
         AND C.ZC_COUNTY_CODE = A.PCPI_COUNTY
         AND C.ZC_STATE_CODE = A.PCPI_STATE
         AND B.PTD_CVR_CODE = 'TF-001'
         AND B.PTD_VALUE_SET2 = A.PCPI_STATE
         AND B.PTD_VALUE_SET4 = A.PCPI_COUNTY
         AND B.PTD_VALUE_SET5 = D.CAC_FLEX_03
         AND D.CAC_FLEX_04 IS NOT NULL
         AND ZC_STATE_CODE =
             (SELECT POL_FLEX_04
                FROM PGIT_POLICY
               WHERE POL_SYS_ID = 541332)
         AND B.PTD_VALUE_SET3 =
             (SELECT POL_FLEX_01
                FROM PGIT_POLICY
               WHERE POL_SYS_ID = 541332)
         AND CAC_TYPE = 'TERR-CODE'
         AND CAC_FLEX_03 = 0;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T19:30:34+00:00Added an answer on May 12, 2026 at 7:30 pm

    A few things:

    First, if you are accessing over half of the data blocks, full scan will be faster because reading the index block is another IO call, so the read of an indexed row is generally twice as expensive time wise as reading a sequential row.

    Second, you need to look at your plans with and without the index. There will be information here that will let you know what changed. If you see a “Merge Join Cartesian” the planner has made an error. That plan is NEVER good. Inner loops of full scans have the same IO cost, but take less memory and temp space.

    Third, you built stats with ANALYZE TABLE. Don’t. Even Oracle says it is bad and broken. Use the dbms_stats package to build your stats, and you will get more accurate stats. If it is still odd, change your sample size, or do full stats instead of estimated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query which is meant to show me any rows in table
I am running oracle and have a query which pulls some results from the
Hey, Lets say we have a query which generates list of city names as
I have an MDX query which lists a measure for all 'Week' and 'Day'
I have a query in which I am pulling the runtime of an executable.
I have an access query which creates some output, 3 columns named e.g. A
I have the following query which works fine with MySQL but refuses to work
Can we have a SQL query which will basically help in viewing table and
I have an Informix SQL query which returns a set of rows. It was
I have a MySQL query in which I want to include a list of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.