• vasil's avatar
    branches/zip: · 48216724
    vasil authored
    The cardinality of every index (the number of different key values) is
    calculated when the table is opened, at SHOW TABLE STATUS,
    ANALYZE TABLE and on other circumstances (like when the table has
    changed too much). Note that if the mysql client is running with the
    auto-rehash setting turned on (default) this causes all tables to be
    opened when it starts.
    
    Previously InnoDB sampled 8 random pages from the index to get an
    estimate of the cardinality. Now the number of sampled pages can be
    changed via the global parameter innodb_stats_sample_pages which can
    be tuned at runtime. The default value for this parameter is 8.
    
    If the value of this parameter is changed, there may be serious problems:
    
    - small values (say, 1) can cause an error in table stats;
    - values much larger than 8 (say, 100), can cause a big slowdown in
      table opening time, SHOW TABLE status, etc.
    - query plans may be different from the old ones.
    
    Approved by:	Heikki
    48216724
ha_innodb.cc 273 KB