MySQL 查询:INFORMATION_SCHEMA.TABLES 的替代方案
为什么 INFORMATION_SCHEMA.TABLES 需要很长时间才能在我的实时服务器上返回结果,而不是在我的本地主机上? (我认为每次执行此操作都会与我的实时服务器发生冲突!)
INFORMATION_SCHEMA.TABLES 是否有其他方法来列出所有表和每个表中的记录数?
这是查询:
SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA LIKE 'db_name'
我需要的只是
<?php echo $item['TABLE_NAME'];?> (using INFORMATION_SCHEMA.TABLES)
<?php echo $item['TABLE_ROWS'];?> (using INFORMATION_SCHEMA.TABLES)
谢谢。
Why does INFORMATION_SCHEMA.TABLES take ages to return result on my live server but not on my localhost? (I think it clashes my live server each time I perform this!)
Any alternatives for INFORMATION_SCHEMA.TABLES to list all tables and numbers of record in each table?
Here is the query:
SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA LIKE 'db_name'
What I need are only
<?php echo $item['TABLE_NAME'];?> (using INFORMATION_SCHEMA.TABLES)
<?php echo $item['TABLE_ROWS'];?> (using INFORMATION_SCHEMA.TABLES)
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
显示表格
。尽管值得怀疑,但这会比 information_schema 查询快得多。除非您的网络连接非常慢SELECT TABLE_NAME, TABLE_ROWS
来自 INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA LIKE 'db_name'
Show Tables
. Although doubtful this will be much faster than an information_schema query. Unless your network connection is dreadfully slowSELECT TABLE_NAME, TABLE_ROWS
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA LIKE 'db_name'
看看
Take a look at