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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:31:42+00:00 2026-06-04T16:31:42+00:00

Recently when I come across some slow queries, I have seen this Using sort_union(sourceClass,destinationClass)

  • 0

Recently when I come across some slow queries, I have seen this “Using sort_union(sourceClass,destinationClass)” phrase in the EXPLAIN plan.

When I run the EXPLAIN with the same query with FORCE INDEX of each index separately, I saw it is doing almost the full table scan due to data distribution.

I understood that this is to improve the performance and this decision is taken by the query optimizer only.

In my query the keys and query are like this

sourceClass:      KEY (`sourceClass`,`sourceId`,`kind`)
destinationClass: KEY (`destinationClass`,`destinationId`,`kind`),

query: 
WHERE (sourceClass='channel' && sourceId=1016) ||  (destinationClass='channel' 
&& destinationId=1016) 

I would like to know at what when the optimizer comes to choose this and are there any disadvantages due to this kind of finding results ?

  • 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-04T16:31:44+00:00Added an answer on June 4, 2026 at 4:31 pm

    All you can expect from the query optimizer its a best effort approach, so it wont necessarilly find the best solution, rather the best solution it can find in a certain period of time. If you want to imrpove this, you need to create an index that improve your query or change the design of your database, the query optimizer will see that and it will choose it as a better query plan.

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

Sidebar

Related Questions

My co-worker and I have come across this warning message a couple times recently.
I have recently come across a very simple Typed DataTable (without using a .XSD)(I've
Recently I have come across a curious pattern in some code. We know that
So I'm writing some code and have recently come across the need to implement
I've been investigating frame breaking code recently and have come across some really bizarre
I have recently come across a situation where code is dynamically loading some libraries,
Recently I have come across Command Pattern . In this pattern Client is responsible
I recently have come across with a need for some type of translation-type that
I have recently come across noty as a jquery plugin as I do not
I've recently come across this website. Now, is there any way I can actually

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.