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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:58:54+00:00 2026-06-14T02:58:54+00:00

I read somewhere that one should not create many indexes on the columns of

  • 0

I read somewhere that one should not create many indexes on the columns of a table for it reduces the performance of operations.

But when I create a table with UNIQUE NOT NULL fields, the MySQL is creating indexes on all the fields by itself. Doesn’t that reduce the performance?? If yes, what flags I need to change the default behaviour? If not, then where I am wrong?

My Table:

CREATE TABLE Users(
Id_usr INT UNSIGNED NOT NULL AUTO_INCREMENT,
PRIMARY KEY(Id_usr),
Email_id varchar(45) UNIQUE NOT NULL,
username varchar(30) UNIQUE NOT NULL,
userpass varchar(30) NOT NULL
);

When I see the table on phpmyadmin:

Indexes: Documentation
Action  Keyname Type    Unique  Packed  Column  Cardinality Collation   Null    Comment
Edit Edit   Drop Drop   PRIMARY BTREE   Yes No  Id_usr  0   A       
Edit Edit   Drop Drop   Email_id    BTREE   Yes No  Email_id    0   A       
Edit Edit   Drop Drop   username    BTREE   Yes No  username    0   A       
  • 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-14T02:58:56+00:00Added an answer on June 14, 2026 at 2:58 am

    But when I create a table with UNIQUE NOT NULL fields, the MySQL is creating indexes on all the fields by itself.

    No, Mysql is creating index on only those fields that you told it to. When you create a column with UNIQUE at the end it means you are telling mysql to add UNIQUE index on that column.

    So for two UNIQUE columns there are two indexes. And for the primary key there is one index. In total 3 indexes. userpass column has no index. Because you didn’t tell it to.

    If you need index and you know why you need UNIQUE index then just add it. Dont think about the performance now. After deploying if you experience any performance problem then think about optimization.

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

Sidebar

Related Questions

I had read somewhere about one specific feature that is present in awk but
I read somewhere that one should never use error conditions as normal program flow.
I read somewhere that somebody could access a config value during run time but
I have read somewhere that ArrayList's add() and remove() operations run in amortized constant
I read somewhere that the ?: operator in C is slightly different in C++,
I read somewhere that Pattern Matching like that supported by the match/case feature in
I read somewhere that you would never run syncdb on a database, post its
I read somewhere that body temperature can be measured through touch screen since different
I read somewhere that, overriding is the means by which you get polymorphism. Polymorphism
I think I read somewhere that cpu's do some floating point computations in 50

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.