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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:31:54+00:00 2026-05-13T16:31:54+00:00

I got question on index strategies for mysql – mainly when to use a

  • 0

I got question on index strategies for mysql – mainly when to use a composite index

I have a fairly common relational db scenario, heres my table set up:

Maintable - table consisting of "products" including brandid, merchantid 

So I create a table to store the brands and merchants

Brandtable - brandname, brandid
Merchanttable - merchantname, merchantid

When I query the Maintable I sometimes query for brandid, sometimes for merchantid and sometimes both. What is best to use in this scenario, a single index on each column, or composite index made up of both?

Also if I wanted to include brandname and merchantname in a fulltext search, how would I achieve this?

Cheers 🙂

  • 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-13T16:31:55+00:00Added an answer on May 13, 2026 at 4:31 pm

    In this case you should use a separate index for each column. MySQL can only use a composite index if your queries involve the leftmost columns in that composite index.

    e.g., if you have a composite index of (brandid,merchantid), that index will be considered if you query on brandid or brandid and merchantid. Not if you only query on merchantid

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

Sidebar

Related Questions

I have a MySQL indexing question for you guys. I've got a very large
Sort of noob-rails question ;): I've got 2 actions in my controller - index
I've got question to you. I have got two project in PHP that uses
I got a question. i have tha following foreach loop: {foreach from=$films item=film key=id}
I've got a, I think fairly easy question, but this is bugging me for
Hi I got a question on whether to use an ArrayList or HashMap .
This is a newbie question... I got this project and I want to use
I have a spurious problem which seems to indicate the index value got from
Hi i've got another question i have the simplest htaccess RewriteEngine On RewriteBase /
I got question about log4net is it working on IIS 7,5? I read lot

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.