Number of records in a table is showing wrongly by INFORMATION_SCHEMA.TABLE_STATISTICS

I have created several tables and populated very few records (like 5 to 10 rows) in each table.

But my metadata table INFORMATION_SCHEMA.TABLE_STATISTICS not showing the values properly.

I have executed ANALYZE command on these tables but no luck.

Still the table is showing the number of rows as zero only. Please let us know how to rectify it.

image

INFORMATION_SCHEMA.TABLE_STATISTICS has a row in it for each table partition. Each table has multiple partitions. What’s the output if you group by DATABASE_NAME and TABLE_NAME and sum the ROWS column?

MemSQL Studio can also give you the row counts. Click on Databases, then click the database to expand the tables list. That shows the row count for the tables.

Thank you very much. With below query , I got total number of records in a table properly.

select TABLE_NAME,sum(ROWS) from INFORMATION_SCHEMA.TABLE_STATISTICS
where DATABASE_NAME=database_23’
group by TABLE_NAME;