MYSQL - count number of rows in each table

后端 未结 3 1501
小鲜肉
小鲜肉 2021-01-31 08:39

I would like to know how many rows are in each table in my database. I\'ve come so far as to having

select count(*) _tablename_; 

However i wou

3条回答
  •  春和景丽
    2021-01-31 09:27

    This following query will return number of rows in each table but it doesn't seem to return exact value all the time

    SELECT table_name, table_rows
    FROM INFORMATION_SCHEMA.TABLES
    WHERE TABLE_SCHEMA = '';
    

    TABLE_ROWS: The number of table rows in the partition. For partitioned InnoDB tables, the row count given in the TABLE_ROWS column is only an estimated value used in SQL optimization, and may not always be exact... for more https://dev.mysql.com/doc/mysql-infoschema-excerpt/5.5/en/partitions-table.html

提交回复
热议问题