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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:33:42+00:00 2026-05-25T18:33:42+00:00

I checked this SO post: What’s the difference between primary key, unique key, and

  • 0

I checked this SO post:

What’s the difference between primary key, unique key, and index in MySQL?

and found the statement:

Also note that columns defined as primary keys or unique keys are automatically indexed in MySQL.

Based on this, I have two questions:

  • Am I safe in assuming that there is no performance benefit to creating an index on a primary key itself because the primary key, by design, is an index?

Perhaps the more important question:

  • If you are doing the classic example people cite, doing SELECT based on lastName and firstName, and that table has a primary key that you SELECT by frequently as well, would you create the index as (primary_key, lastName, firstName) or just (lastName, firstName) since the primary key is already an index?
  • 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-25T18:33:42+00:00Added an answer on May 25, 2026 at 6:33 pm

    To your first question, yets, you’re safe to assume that.

    To the second question:

    Indexes help to speed up searching – it’s like an index in a book. They can help the DB engine jump to the correct record, just as an index can help you jump to the right page in a book.

    The benefit to indexes that you might create youself depends on how you intend to search the data.

    In your example, I’d create an INDEX on the name fields if you’re going to search on them in your app.

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

Sidebar

Related Questions

How do I load a MOV file into Flash 9 I checked this post
Using the following steps: (I have checked this similar post , which does not
In this post , I found out that it was possible to create individual
I checked this post already. But it doesn't answer my question. I want to
I have made this mistake several times, and found myself referencing This Post every
I have a 2884765579 bytes file. This is double checked with this function, that
$('input[type=checkbox]').unbind().click(function(e){ $(this).attr('checked', true) return false; }); I NEED to return false because I have
I am calling a WebMethod from this code: if($(this).attr(checked)) { .. MyWebMethod(variable1, variable2, onSuccessFunction);
When I bind a function to a checkbox element like: $(#myCheckbox).click( function() { alert($(this).is(:checked));
Checkstyle reports this code as The double-checked locking idiom is broken, but I don't

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.