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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:54:27+00:00 2026-06-09T18:54:27+00:00

If I have this index: (col1, col2, col3) I know it helps when I

  • 0

If I have this index:

(col1, col2, col3)

I know it helps when I search through (col1); (col1, col2); (col1, col2, col3).

If I create another index with the exactly same columns, phpMyAdmin will warn me that one of those indexes may be removed, because they are the same.

However, if I have these indexes:

(col1, col2, col3)

(col1, col2)

(col1)

phpMyAdmin won’t warn me at all.

So my question is, are the last two indexes necessary in any case? I think only the first index is enough.

Thank you.

  • 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-09T18:54:29+00:00Added an answer on June 9, 2026 at 6:54 pm

    MySQL will only use one index (the leftmost) to optimize the search. Quoting from the documentation:

    “If the table has a multiple-column index, any leftmost prefix of the index can be used by the optimizer to find rows. For example, if you have a three-column index on (col1, col2, col3), you have indexed search capabilities on (col1), (col1, col2), and (col1, col2, col3).“

    However, if any of the indexes are UNIQUE, then there’s probably a good reason for them to be there.

    If during your analysis you find that any of the columns are frequently used apart from one another, then you should consider adding separate indexes for each to optimize those queries.

    E.g.

    ALTER TABLE tablename ADD INDEX (col1), ADD INDEX (col2), ADD INDEX (col3);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

suppose that I have this RDBM table ( Entity-attribute-value_model ): col1: entityID col2: attributeName
I have this html <form method=POST action= id=order class=forms> <div> <span class=col1>Ref.</span> <span class=col2>Number</span>
I have a model called A with columns col and col2 . The col1
Imagine that we have a query like this: select a.col1, b.col2 from t1 a
I have this part of the function : $jQ('.product-collateral .product-tabs li').each(function(index){ $jQ(this).attr('id', $jQ(this).find('h3').attr('class')); if(index
I have this code in my index.php. In Mozilla its ok. But in Ie
I have this page: http://www.thedome.it/cmsms/index.php?page=alla-spina I'd like to send a newsletter to subscribers every
I have this script in the head of my index.html. I want different scripts
I have this controller: public class StandingsController : Controller { public ViewResult Index(int id)
I have this simple code in my user_controller.rb file #listing all users def index

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.