Conoscere lo stato di frammentazione delle tabelle
Quando una tabella è molto frammentata, occorre eseguire un OPTIMIZE. Ecco allora come conoscere la percentuale di frammentazione delle tabelle
1SELECT table_schema, table_name, FLOOR(100 * data_free / data_length) AS fragmentation
2FROM information_schema.tables
3WHERE engine IN('Aria', 'MyISAM', 'MEMORY') AND table_schema NOT IN ('mysql', 'information_schema', 'performance_schema', 'test')
4ORDER BY fragmentation DESC;
- Current rating: 0.0/5
- 1
- 2
- 3
- 4
- 5
Tip precedente: Impostare un campo al suo valore di default
Tip successivo: Copiare una tabella