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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:12:48+00:00 2026-05-16T07:12:48+00:00

Basically, if I have a table with composite indices (colA, colB, colC) and (colB,

  • 0

Basically, if I have a table with composite indices (colA, colB, colC) and (colB, colD, colE), is MySQL able to take advantage of their overlap on colB to combine them and speed up a query involving colA, colB and colD, even if there is no single index covering these three particular columns?

I tried using EXPLAIN on a test case like this, but even though it recognized both indices as possible keys, it only used the first one. However, I do not know if this was because it is unable to make the combination or because the optimizer didn’t think it was worth it given the number of rows.

I would expect it should be able to, but couldn’t find any straight confirmation around. Thanks for your input.

  • 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-16T07:12:49+00:00Added an answer on May 16, 2026 at 7:12 am

    I can’t find any definitive answer either, but I think the answer is that it depends on the query and the data in the tables. A multiple-column index can be used if the query refers to any of the left-most columns. With your (ColA, ColB, ColC) index, the index may be used for queries which refer to (ColA), (ColA, ColB) or (ColA, ColB, ColC). The same principle is true for your other index.

    When two separate indexes are available, the MySQL optimizer will choose between performing an intersection based on both indexes, or using a single index, and filtering out the remaining results. I suspect that the same will be true if both those separate indexes are multi-column indexes, and if the query refers to the left-most part of the indexes (as your example does with ColA, ColB, ColC, ColD.

    You might find these links of use (but I don’t think any of them will provide a definitive answer):

    MySQL Manual
    Multiple-Column Indexes
    How MySQL Uses Indexes

    MySQL Performance Blog
    Multi Column indexes vs Index Merge

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

Sidebar

Related Questions

I have a mysql table with three columns: username, location, timestamp. This is basically
Basically, I have multiple URL's stored in a MySQL table. I want to pull
basically i have this problem i have a table of posts(in my mysql database)
Basically I have a table which is used to hold employee work wear details.
So basically I have a table - ID | from | To ----------------- 1
If I were to select a row from a table I basically have two
Basically I have a database with two tables, that is, Updates table and Images
I have a table, called 'files', where I store file_id's. Basically, users on my
I'm seeing basically the same issue described here I have a table that starts
Is there any name for the following DB table design: Basically we have generic

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.