Is there a MySQL command to get a count on the # of rows in a table, & if so, what is it?
是否有MySQL命令来计算表中的行数,如果是,那么它是什么?
2 个解决方案
#2
2
A nice way to get AN ESTIMATE of the number of rows can be via meta-data information in the information_schema tables.
获取行数的AN ESTIMATE的好方法可以是通过information_schema表中的元数据信息。
Note, this is just an ESTIMATE used for query optimizations.
请注意,这只是用于查询优化的ESTIMATE。
There may be a way to get exact # of rows from the information_schema, but I am not 100% sure if this is possible.
可能有一种方法可以从information_schema中获取确切的行数,但我不能100%确定是否可行。
SELECT table_schema, table_name, table_rows FROM information_schema.tables ORDER BY table_rows DESC
#1
#2
2
A nice way to get AN ESTIMATE of the number of rows can be via meta-data information in the information_schema tables.
获取行数的AN ESTIMATE的好方法可以是通过information_schema表中的元数据信息。
Note, this is just an ESTIMATE used for query optimizations.
请注意,这只是用于查询优化的ESTIMATE。
There may be a way to get exact # of rows from the information_schema, but I am not 100% sure if this is possible.
可能有一种方法可以从information_schema中获取确切的行数,但我不能100%确定是否可行。
SELECT table_schema, table_name, table_rows FROM information_schema.tables ORDER BY table_rows DESC