26 lines
525 B
Plaintext
26 lines
525 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
(
|
||
|
mysql --defaults-file=/etc/mysql/debian.cnf hydra <<EOF
|
||
|
SELECT
|
||
|
TABLE_NAME AS \`Table\`,
|
||
|
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS \`Size\`
|
||
|
FROM
|
||
|
information_schema.TABLES
|
||
|
WHERE
|
||
|
TABLE_SCHEMA = "hydra"
|
||
|
ORDER BY
|
||
|
(DATA_LENGTH + INDEX_LENGTH)
|
||
|
DESC;
|
||
|
EOF
|
||
|
) | while read table size; do
|
||
|
if [ "${table}" != Table ]; then
|
||
|
real_size=$(ls -lh /var/lib/mysql/hydra/${table}.ibd | cut -d' ' -f 5)
|
||
|
else
|
||
|
real_size="Taille réelle"
|
||
|
fi
|
||
|
echo -e ${table}\\t${size}M\\t${real_size}
|
||
|
done
|
||
|
|
||
|
echo $a
|