[MySQL]查询所有表数据量

1. 所有表

mysql> 
SELECT TABLE_NAME,TABLE_ROWS FROM information_schema.`TABLES`
WHERE TABLE_SCHEMA = (SELECT database())
ORDER BY TABLE_ROWS DESC;
+------------------------+------------+
| TABLE_NAME             | TABLE_ROWS |
+------------------------+------------+
| cp_dicom_file_rela     |    1440780 |
| blade_log_error        |       9278 |
| blade_region           |       3231 |
| cp_signature           |       2385 |
| cp_dicom               |       1117 |
| blade_menu             |        175 |
| blade_dict             |         65 |
| blade_param            |          6 |
| blade_post             |          4 |
| blade_datasource       |          3 |
| blade_notice           |          3 |
| blade_dict_biz         |          3 |
| blade_client           |          3 |
| blade_role             |          2 |
| blade_oss              |          2 |
| blade_sms              |          0 |
| blade_report_file      |          0 |
| blade_tenant           |          0 |
| blade_tenant_package   |          0 |
| blade_role_menu        |          0 |
| blade_top_menu         |          0 |
| blade_role_scope       |          0 |
| blade_top_menu_setting |          0 |
| blade_scope_api        |          0 |
| blade_process_leave    |          0 |
| blade_scope_data       |          0 |
| blade_user_dept        |          0 |
| blade_user_oauth       |          0 |
| blade_user_other       |          0 |
| blade_user_web         |          0 |
| blade_user             |          0 |
| blade_user_app         |          0 |
| cp_pdf_template        |          0 |
| blade_code             |          0 |
| blade_log_usual        |          0 |
| blade_dept             |          0 |
| blade_attach           |          0 |
| blade_log_api          |          0 |
+------------------------+------------+
38 rows in set (0.00 sec)

2. 单表查询

SELECT SQL_CALC_FOUND_ROWS 1 FROM 表名 limit 1;
SELECT found_rows() AS rowcount;
posted @ 2022-09-05 09:18  LeoShi2020  阅读(2514)  评论(0编辑  收藏  举报