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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:47:27+00:00 2026-06-13T17:47:27+00:00

I have a pretty big query. The performance has always been reasonably acceptable, but

  • 0

I have a pretty big query.

The performance has always been reasonably acceptable, but I now have this problem.

I need to join a table more than once, using aliases of course, but doing so causes a massive performance hit.

It’s a huge query so I won’t post it all but here’s the gist:

SELECT table1.name,
       ALIAS1.CODE AS "Sequence"
...
FROM table1
...
LEFT JOIN table2 ALIAS1
ON ALIAS1.COLUMN1 = table1.key1
AND ALIAS1.COLUMN2 = 'aaba'
AND ALIAS1.COLUMN3 = '00001'
...

This one is fine, running in about 90 seconds. But if I add the same table again as in the following, execution time increases exponentially (so far 2 hours and still running):

SELECT table1.name,
       ALIAS1.CODE AS "Sequence",
       ALIAS2.CODE AS "Rating"
...
FROM table1
...
LEFT JOIN table2 ALIAS1
ON ALIAS1.COLUMN1 = table1.key1
AND ALIAS1.COLUMN2 = 'aaba'
AND ALIAS1.COLUMN3 = '00001'

LEFT JOIN table2 ALIAS2
ON ALIAS2.COLUMN1 = table1.key1
AND ALIAS2.COLUMN2 = 'ffhr'
AND ALIAS2.COLUMN3 = '00107'

What I need to know is, what factors could be causing this?

It looks to me like the indexes should be ok otherwise the first join would be a problem.

Why would the second join be such an issue?

I actually need to join the same table a third time, but obviously this is a no-go as things stand!

  • 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-13T17:47:28+00:00Added an answer on June 13, 2026 at 5:47 pm
    ON ALIAS1.COLUMN1 = table1.key1
    AND ALIAS1.COLUMN2 = 'aaba'
    AND ALIAS1.COLUMN3 = '00001'
    

    When you join on three columns simultaneously, you should have a multi-column index that includes all three columns.

    Perhaps instead of joining on constant values, you could put those filters in a WHERE clause.

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

Sidebar

Related Questions

I have been trying to serialize a pretty big object. This object uses dictionaries
I have a pretty big problem with my TabHost. Although I have declared all
I have a pretty big query to pull out the information about reports from
I'm pretty new in OOP but have to develop a big project... Just for
I have a pretty big form, wich has two possibilities. It is a form
I have a pretty big problem. I am going through a Ruby on Rails
I have a pretty big data entry form which has many text fields ,
I have a pretty big query, that is generated in in a script, to
I have a pretty big view which is like 1000 x 1000. So I
I have a very strange situation. I´m working on a pretty big Java application

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.