The sampled_pages_read  and sampled_pages_skipped INNODB_METRICS  counters can be used to monitor sampling of InnoDB  data pages. (For general INNODB_METRICS  counter usage information, see Section 26.4.23, “The INFORMATION_SCHEMA INNODB_METRICS Table” .) 

The following example demonstrates sampling counter usage, which requires enabling the counters prior to generating histogram statistics. 

mysql> SET GLOBAL innodb_monitor_enable = ’sampled%’; mysql> USE employees; mysql> ANALYZE TABLE employees UPDATE HISTOGRAM ON birth_date WITH 16 BUCKETS\G *************************** 1. row *************************** Table: employees.employees Op: histogram Msg_type: status Msg_text: Histogram statistics created for column ’birth_date’. mysql> USE INFORMATION_SCHEMA; mysql> SELECT NAME, COUNT FROM INNODB_METRICS WHERE NAME LIKE ’sampled%’\G *************************** 1. row ***************************  NAME: sampled_pages_read COUNT: 43 *************************** 2. row ***************************  NAME: sampled_pages_skipped COUNT: 843 

This formula approximates a sampling rate based on the sampling counter data: 

sampling rate = sampled_page_read/(sampled_pages_read + sampled_pages_skipped) 

A sampling rate based on sampling counter data is roughly the same as the sampling-rate  value in the HISTOGRAM  column of INFORMATION_SCHEMA.COLUMN_STATISTICS  table. 

For information about memory allocations performed for histogram generation, monitor the Performance Schema memory/sql/histograms  instrument. See Section 27.12.20.10, “Memory Summary Tables” . 

## Other Considerations 

ANALYZE TABLE  clears table statistics from the INFORMATION_SCHEMA.INNODB_TABLESTATS  table and sets the STATS_INITIALIZED  column to Uninitialized . Statistics are collected again the next time the table is accessed. 

## 13.7.3.2 CHECK TABLE Statement 

CHECK TABLE tbl_name  [, tbl_name ] ... [ option ] ... option : { FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED | CHANGED } 

CHECK TABLE  checks a table or tables for errors. CHECK TABLE  can also check views for problems, such as tables that are referenced in the view definition that no longer exist. 

To check a table, you must have some privilege for it. 

