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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:26:58+00:00 2026-05-24T17:26:58+00:00

I have two views in an ORACLE DB: The view USERS with columns: UserId

  • 0

I have two views in an ORACLE DB:

The view USERS with columns:
UserId | GroupId | Details

where there’s 1 record for each User, total 40.000, and there c.a. 1-30 users in each Group.

and

The view SUMMARY with columns:
UserId | Summary 

where there’s 1 record for each User

The SUMMARY view is very complex but is still quite fast when i query it based on user.
That is:

select * from SUMMARY where UserId='some_user_id'

performs in 0,1 sec

The USERS view is pretty simple (it’s a union all of USERS_TYPE1 and USERS_TYPE2 tables)
and a query of the type:

select * from USERS where GroupId='some_group_id'

performs in 0,02 sec

Now here’s the catch,
when I do:

select * from USERS JOIN SUMMARY 
ON USERS.UserId = SUMMARY.UserId
WHERE USERS.GroupId = 'some_group_id'

I get AWFUL performance of 90seconds – even though there are only 3 users in the group.

This should take only a fraction of a second if the user ID’s are found first and then the SUMMARY table is queried with those user ID’s.
Is there a way I can hint the DB to do that?

I have indexes based on UserId, GroupId and (GroupId,UserId) on all underlying tables.

((This is pretty hard to reproduce In a simple manner since the complex view has a lot of underlying tables. I have a couple of versions of the SUMMARY view. In some cases (depending on how SUMMARY is built) it stops being awful when i materialize the Users view, but in other cases it does not.))

  • 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-24T17:26:59+00:00Added an answer on May 24, 2026 at 5:26 pm

    You could try

      SELECT * 
      FROM
        (select * from USERS
        WHERE USERS.GroupId = 'some_group_id') u,
        summary
      WHERE USERS.UserId = SUMMARY.UserId
    

    Also specify exactly what columns you want, rather than select * (you obviously don’t need both versions of the UserId)

    It MAY be worth trying

      SELECT * 
      FROM
        (select users.*, rownum rn from USERS
        WHERE USERS.GroupId = 'some_group_id') u,
        summary
      WHERE USERS.UserId = SUMMARY.UserId
    

    which will force it to evaluate the inline view first.

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

Sidebar

Related Questions

I have two users Bob and Alice in Oracle, both created by running the
Question: Does Informix have a construct equivalent to Oracle's materialized view or is there
I have two views: one is a normal view built from one table with
I have two views, the parent view opens a pop over that has a
I have two views in my app, one is a general view where CoreLocation
i have two views 1st one is displaying list (uitableview used), user will select
I have two views (UIView) set-up: parent and child view. The child view is
I have two views, a game view and an admob view. I want the
I have two views that render a table on each. Most of the tables
I have two tables: Personnel with ID,Name,... columns and User with PersonnelID (FK 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.