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

  • Home
  • SEARCH
  • 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 9074771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:42:55+00:00 2026-06-16T18:42:55+00:00

I am creating an event to user lookup table using the Innodb search engine.

  • 0

I am creating an event to user lookup table using the Innodb search engine.

Table Event_Users

event_id
user_id

Index (PRIMARY) -> event_id, user_id
Index (secondary) -> user_id, event_id ??

The application will search user to event and event to user. How do I define the second index if the primary key is clustered? Should it simply be user_id and then MYSQL will figure out that event_id is already present in the PK or should I be redundant and include user_id, event_id in the secondary index?

In addition, is this a good use of a clustered index? Any guidance and help with Innodb clustered indexes would be greatly appreciated. Thanks!

  • 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-16T18:42:58+00:00Added an answer on June 16, 2026 at 6:42 pm

    MySQL should be able to use the fields in the PK as a covering index without making a composite secondary index.

    Therefore:

    Table (Engine = INNODB)

    column_a  (int)
    column_b  (int)
    
    Primary Key -> column_a, column_b
    

    If you would like to search by column_b simply add index: column_b.

    Since the table using the Innodb engine, the PK will exist in the column_b index. Mysql will be able to use the index (using index). No need to create index column_b, column_a as this would be redundant. – Remember, inndob clusters by PK and all indexes reference the PK.

    A surrogate key is a poor choice for this design because extra work would have to be made to ensure column_a, column_b does not already exist.

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

Sidebar

Related Questions

I'm creating a Chrome extension using user's key event. But I want to alert
I am creating a new event source and logging a message using the code
I am programatically creating a web browser and using the documentcompleted event handler to
I am creating an event-based API where a user can subscribe to an event
I'm having issues in creating event handler that will be triggered while user moves
I am creating event search application, we set search criteria from one screen populate
How do I upload image when creating the event on graph api? Example: user.facebook.put_object(me,
Disclaimer: I'm new to web development. I'm creating an event calendar using CodeIgniter, and
I am creating a user input at one of the events: var throwConnectBox =
I have Visual Studio 2010. I learned that for creating event handlers we have

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.