发布于 4年前

mysql中查询所有表得创建时间、修改时间、引擎、数据量的sql

select * from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = 'DB_NAME' order by create_time desc;

可查询DB_NAME库下所有数据表的创建时间,可按照创建时间倒叙排序。

mysql-> select * from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = 'DB_NAME' order by create_time desc\G;
*************************** 1. row ***************************
  TABLE_CATALOG: def
   TABLE_SCHEMA: dn_name
     TABLE_NAME: be_channel_report
     TABLE_TYPE: BASE TABLE
         ENGINE: MyISAM
        VERSION: 10
     ROW_FORMAT: Dynamic
     TABLE_ROWS: 758
 AVG_ROW_LENGTH: 39
    DATA_LENGTH: 29680
MAX_DATA_LENGTH: 281474976710655
   INDEX_LENGTH: 16384
      DATA_FREE: 0
 AUTO_INCREMENT: 213516
    CREATE_TIME: 2018-03-22 13:40:32
    UPDATE_TIME: 2018-08-15 18:10:02
     CHECK_TIME: NULL
TABLE_COLLATION: utf8_general_ci
       CHECKSUM: NULL
 CREATE_OPTIONS: 
  TABLE_COMMENT: ***
©2020 edoou.com   京ICP备16001874号-3