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 8765697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:21:14+00:00 2026-06-13T16:21:14+00:00

We have a table called t_reading , with the following schema: MEAS_ASS_ID NUMBER(12,0) READ_DATE

  • 0

We have a table called t_reading, with the following schema:

MEAS_ASS_ID     NUMBER(12,0)
READ_DATE       DATE
READ_TIME       VARCHAR2(5 BYTE)
NUMERIC_VAL     NUMBER
CHANGE_REASON   VARCHAR2(240 BYTE)
OLD_IND         NUMBER(1,0)

This table is indexed as follows:

CREATE INDEX RED_X4 ON T_READING
(
  "OLD_IND",
  "READ_DATE" DESC,
  "MEAS_ASS_ID",
  "READ_TIME"
)

This exact table (with the same data) exists on two servers, the only difference is the Oracle version installed on each one.

The query in question is:

SELECT * FROM t_reading WHERE OLD_IND = 0 AND MEAS_ASS_ID IN (5022, 5003) AND read_date BETWEEN to_date('30/10/2012', 'dd/mm/yyyy') AND to_date('31/10/2012', 'dd/mm/yyyy');

This query executes in less than a second on Oracle 10, and around a minute in Oracle 9.

Are we missing something?

EDIT:

Execution plan for Oracle 9:
enter image description here

Execution plan for Oracle 10:
enter image description here

  • 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-06-13T16:21:16+00:00Added an answer on June 13, 2026 at 4:21 pm

    “Are we missing something?”

    Almost certainly, but it’s difficult for us to tell you what.

    There were some performance improvements in the CBO from 9i to 10g but it’s unlikely to make that much difference. So it must be some variation in your systems, which is obviously the hardest thing for us to diagnose, blind and remote as we are.

    So, first things to rule out are general system diffences – disk speeds, i/o bottlenecks, memory sizing, etc. You say you have two servers, do they have different specs? Whilst it will require assistence from an sysadmin type to investigate these things, we can discount them with a single question: is it just this query, or can you reproduce this effect with many different queries?

    If is just the query, there are at least three possible explanations.

    One is data distribution. How was the data populated in the two databases? If the 10g was exported from the 9i database was it sorted in some fashion? Even if it wasn’t it is possible that the ETL process has compacted and organised the data and built the fresh indexes in a way which improves the access times.

    Another is statistics. Are the 10g statistics fresh and realistic, whilst the 9i statistics are stale and misleading?

    A third possibility is a stored execution plan. (You have posted a query with literals, this only applies to queries with bind variables.) Searches on date ranges are notoriously hard to tune. A date range of to_date('30/10/2012', 'dd/mm/yyyy') AND to_date('31/10/2012', 'dd/mm/yyyy') suits one sort of plan, whereas date range of to_date('01/01/2010', 'dd/mm/yyyy') AND to_date('31/10/2012', 'dd/mm/yyyy') may well suit a different approach. If the extant plan on the 9i database suits a broader range then queries for a narrow range may take a long time.


    While I’ve been typing this you have published the explain plans. The killer detail is at the bottom of the 9i plan:

    Note: rule-based optimization
    

    You haven’t got any stats for the table or the index, so the optimizer is applying the dumb defaults of the RBO. You should really address this, but it’s not a simple task. You may need to gather stats for all your tables. You may need to change the OPTIMIZER_MODE in the init.ora file. You may need to undertake a regression test of all the queries on your database. So, it’s not something you shoudl do lightly.

    In the meantime, if this query is bugging you, you’ll need to wrnagle the Rule-Based Optimizer the old-fashioned way. Find out more.

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

Sidebar

Related Questions

I have a table called sellerparams with a number of columns, one of them
I have a table called 'survey_product' with the following structure: id int(11) order_id int(11)
I have a table called Sentence that has the following fields: ID <--- OK
suppose I have the following source table (called S): name gender code Bob 0
I have table called stats . In am inserting yes or no in the
i have table called as Support, which have a field named Name and contains
I have table called Buttons. Buttons table i have column button_number . Table contain
I have table called posts in my DB. Each post has field called social_network
I have a table called 'MyTable' that looks like: ID | Item | Type
I have a table called States and i am displaying values of states in

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.