Announcement

Announcement Module
Collapse
No announcement yet.

decreased row count after an alter table

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • decreased row count after an alter table

    I ran an alter table (increased index length on a varchar column from 5 to 10 characters) on a large table (several million)rows.

    A show-table-status after the alter shows about 10% decreased row count. I spot-checked and it doesn't seem like there is any actual data loss.

    Wondering what could be happening?

    Running Mysql 5.0.60, with InnoDB.

  • #2
    InnoDB's row statistics are only approximate estimates, so it's nothing to worry about.

    Comment


    • #3
      Thanks!

      Wondering why is that? And why would the number change (so dramatically) with an alter-table?

      Comment


      • #4
        The stats are calculated by random dives into the index tree. These samples are used to estimate the overall distribution. Check the docs for the details. If you run SHOW TABLE STATUS several times you will get different answers (in most cases) due to the randomness. It is not uncommon for the numbers to vary by up to a factor of 10.

        Comment

        Working...
        X