標籤:mysql 表的行數 排序
隨著公司的業務越來越大,工作中需要對某一個資料庫的表進行分表,為了做的更細緻一點,在該資料庫中,將所有表,按行數從到小排序:
實現方式:
mysql> use information_schema;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select table_name,table_rows from tables order by table_rows desc limit 30;
+----------------------+------------+
| table_name | table_rows |
+----------------------+------------+
| log | 144359031 |
| base_log | 49708134 |
| base_log_201708 | 15838445 |
| log_201706 | 11768358 |
| customer_log | 9625275 |
| log_201708 | 7856959 |
| base_log_201707 | 6270253 |
| debug_log | 5708789 |
| allocate_log | 5612445 |
| web_api_log | 5078173 |
| log_201707 | 4353787 |
| communication_log | 3069630 |
| base_log_201706 | 2751581 |
| log_201709 | 2028525 |
| sms_log | 1074787 |
| service_log | 977777 |
| fjs_behavior_log | 819606 |
| ocdc_customer | 811990 |
| base_log_201709 | 733253 |
| 5kcrm_fenpei_log | 524252 |
| customer_sale | 517155 |
| sys_crmdata_log | 500943 |
| 5kcrm_log | 471193 |
| phone_log | 470699 |
| 5kcrm_r_customer_log | 453022 |
| realestate_needs | 434770 |
| service_customer_log | 428040 |
| mail | 342659 |
| users | 331449 |
| phone_areas | 328089 |
+----------------------+------------+
30 rows in set (0.97 sec)
本文出自 “蓮池管俊濤的51cto部落格” 部落格,謝絕轉載!
將mysql某個資料庫中表的行數從大到小排序