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

  • Home
  • SEARCH
  • 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 7619493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:42:03+00:00 2026-05-31T03:42:03+00:00

I have a query in the form: select a, b, c, d, e, f,

  • 0

I have a query in the form:

select a, b, c, d, e, f, g, h,
    row_number () over (partition by a, b order by c, d, e, f) as order
from table;

And it’s performance is kind of terrible.

We have tried creating 2 indexes, the first for the partition by columns (a and b) and the second for the order by columns (c, d, e, f).

Using the explain plan we have found that indexes are not being used. Altough they are usefeul for other querys with a group by clause.

Any idea on how to refactor the query, or re-create the indexes so that they help with performance on this query?

Thanks in advance

  • 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-31T03:42:05+00:00Added an answer on May 31, 2026 at 3:42 am

    To quote from a previous answer of mine:

    The two most common reasons for a query not using indexes are:

    1. It’s quicker to do a full table scan.
    2. Poor statistics.

    In your case, you’re selecting everything from the table so I’m guessing 1. is the main reason, in which case you’re hosed.

    You could try the index a, b, c, d, e, f, and I’m not saying that gathering statistics won’t help. If you haven’t I’d recommend doing it anyway:

    begin
    
       dbms_stats.gather_table_stats (
       ownname => user, 
       tabname => 'MY_TABLE',
       estimate_percent => 25,
       method_opt => 'FOR ALL INDEXED COLUMNS',
       cascade => TRUE );
    
    end;
    

    There’s also the remote possibility that your table is massively fragmented. If so alter table my_table move and then gather statistics.

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

Sidebar

Related Questions

I have a query of the following form: SELECT * FROM MyTable WHERE Timestamp
I have a linq query. I have a bunch of parameters from a form
I have a form that shows results from a database query, these results can
I have a table t1 and t2 which I join and order to form
I have an SQL query that takes the following form: UPDATE foo SET flag=true
I have a search form with a query builder. The builder is activated by
I have a form that sometimes gets linked to with some query string parameters.
I have a search form used to query service provisions, which I will call
I have made a form that accepts query and executes it through php. I
I have a form where when it was created it will this query public

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.