mysql查询数据库储存数据的占用容量大小

mysql查询数据库储存数据的占用容量大小

可是使用mysql的information_schema数据库,储存的就是数据库元数据相关信息

  1. 查询指定数据库的容量大小,返回的单位是字节
        select sum(DATA_LENGTH)
        from information_schema.TABLES
        where table_schema = '你的数据库'
  1. 查询指定数据表的大小,返回的单位是字节
        select sum(DATA_LENGTH)
        from information_schema.TABLES
        where table_schema = '你的数据库'
          and table_name = '你的数据表';

猜你喜欢

转载自blog.csdn.net/qq_42900469/article/details/131041606
今日推荐