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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:54:37+00:00 2026-05-23T09:54:37+00:00

I was reading this question MySQL – why not index every field? and decided

  • 0

I was reading this question MySQL – why not index every field? and decided to do some tests.

Having two equivalent tables (a and b), each one with 5.000.000 rows and 3 columns (int, int, varchar), I indexed all the columns on table b and just indexed one column (primary key) on table a.

Results were as follow:

Edit: times are the same as the below ones for rows changed/unchanged.

mysql> update a set c = '1000000' where c = '1000000';
Query OK, 0 rows affected (2.13 sec)
Rows matched: 1  Changed: 0  Warnings: 0

mysql> update b set c = '1000000' where c = '1000000';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

Now, this is totally the opposite of what I was expecting after reading the answers to the question.

Is there any “benchmarkable” drawback to not index every column of a table?


Edit: problem was that every tuple in the table had an unique value and updating a single indexed and unique row was quick enough to get the 0.00 mark. However, when I updated subsets of rows like Flimzy and Searlea specified, updating non indexed columns were quicker than updating indexed one, like it should be.

Results in case you want to see them:

mysql> update a set b = 98;
Query OK, 5000002 rows affected (10.85 sec)
Rows matched: 5000002  Changed: 5000002  Warnings: 0

mysql> update b set b = 98;
Query OK, 4988890 rows affected (1 min 32.69 sec)
Rows matched: 5000001  Changed: 4988890  Warnings: 0
  • 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-23T09:54:37+00:00Added an answer on May 23, 2026 at 9:54 am

    Of course there are drawbacks to indexing every column. With more indexes, writes (INSERT, UPDATE, and DELETE) take longer, because there are more things to write to the database.

    Indexes can only speed things up for reads. Meaning, SELECT, DELETE…WHERE and UPDATE…WHERE.

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

Sidebar

Related Questions

[Edit #3] - to anyone reading this question: do not under any circumstance use
Reading this question I found this as (note the quotation marks) code to solve
After reading this question , I was reminded of when I was taught Java
I was reading this question about how to parse URLs out of web pages
Reading through this question on multi-threaded javascript, I was wondering if there would be
After reading this on the question How do I uniquely identify computers visiting my
Reading over the responses to this question Disadvantages of Test Driven Development? I got
After posting this question and reading that one I realized that it is very
After reading the nice answers in this question , I watched the screencasts by
This is a continuation of my question about reading the superblock . Let's say

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.