add mysql/size
This commit is contained in:
parent
22d6f4dd13
commit
09d908d255
26
mysql/size.md
Normal file
26
mysql/size.md
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
format: markdown
|
||||
...
|
||||
|
||||
Pour obtenir la taille de *toutes* les bases de données présentes sur le serveur :
|
||||
|
||||
```bash
|
||||
SELECT table_schema AS 'DB Name', ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) AS 'DB Size in MB' FROM information_schema.tables GROUP BY table_schema;
|
||||
```
|
||||
Pour obtenir la taille d'une base en particulier :
|
||||
|
||||
```bash
|
||||
SELECT table_schema AS 'DB Name', ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) AS 'DB Size in MB' FROM information_schema.tables WHERE table_schema = '##DBNAME##' GROUP BY table_schema;
|
||||
```
|
||||
|
||||
Pour obtenir la taille de toutes les tables d'un base de données spécifique :
|
||||
|
||||
```bash
|
||||
SELECT TABLE_NAME AS `Table`, ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)` FROM information_schema.TABLES WHERE TABLE_SCHEMA = "<DBNAME>" ORDER BY (DATA_LENGTH + INDEX_LENGTH) DESC;
|
||||
```
|
||||
|
||||
Pour obtenir la taille de toutes les tables de *toutes* les bases de données :
|
||||
|
||||
```bash
|
||||
SELECT TABLE_SCHEMA AS `Database`, TABLE_NAME AS `Table`, ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)` FROM information_schema.TABLES ORDER BY (DATA_LENGTH + INDEX_LENGTH) DESC;
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user