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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:27:55+00:00 2026-05-24T18:27:55+00:00

I have a partitioned table by date (by days) and a local index on

  • 0

I have a partitioned table by date (by days) and a local index on the fields (including date field). If I make a query:

SELECT * FROM table t WHERE t.fdate = ‘30.06.2011’

it is fulfilled quickly, but when I make

SELECT * FROM table t WHERE EXTRACT(month from t.fdate) = 6 AND
EXTRACT(year from t.fdate) = 2011

it is fulfilled approximately 200 seconds.

How to optimize this query? May be I need to create local index on EXTRACT(month from date) AND EXTRACT(year from date)?

  • 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-24T18:27:55+00:00Added an answer on May 24, 2026 at 6:27 pm

    As you have an index on the date field, you should write your query in a way that this index can be used. This is not possible with the EXTRACT functions since Oracle must go through all data and compute the condition for each row to determine if it matches.

    The date index can be used if you have a specific date or a range of dates. In your case, you’re looking for a range of dates. So the query could be written as:

    SELECT * FROM TABLE T
    WHERE T.FDATE BETWEEN TO_DATE('1.6.2011', 'DD.MM.YYYY') AND TO_DATE('30.6.2011', 'DD.MM.YYYY');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following query SELECT Id, Request, BookingDate, BookingId FROM Table ORDER BY
I have a table with fields 1: Visit Place 2: Visit Date I have
I have a query: select event_type, department_name, effective_time, row_number() OVER (PARTITION BY event_type,department_name ORDER
I have a table that is partitioned by TRANSACTION_DATE_TIME. Table has a column: ID.
I have a large (150m+ row) table, which is partitioned into quarters using a
I have a partitioned table that belongs to tablespace report . I want to
I have a table with a DATE column with time (as usual in Oracle
I have a hive table with columns -> date, hr, count where date, hr
I have a table that is partitioned by month (partmonth int). The stored proc
I have a list partitioned table on a foreign key. So if I want

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.