gpt4 book ai didi

MySQL 8 Select语句得到 'Last_query_cost'

转载 作者:行者123 更新时间:2023-11-29 05:01:24 26 4
gpt4 key购买 nike

有一个 MySQL CLI 命令

SHOW STATUS LIKE 'Last_query_cost';

但是如何使用简单的 SELECT 查询获取该信息?

是否有任何类型的转义/包装 MySQL CLI 命令以便它可以在普通 SELECT 语句中使用?

也许我可以使用 SELECT 查询一个模式,以获取 SHOW STATUS LIKE 'Last_query_cost'; 命令提供的信息?

最佳答案

在 mysql v5.7 及更早版本中,所有全局变量和 session 变量都存储在 INFORMATION_SCHEMA GLOBAL_STATUSSESSION_STATUS 表中。

作为mysql manual说:

The GLOBAL_STATUS and SESSION_STATUS tables provide information about server status variables. Their contents correspond to the information produced by the SHOW GLOBAL STATUS and SHOW SESSION STATUS statements.

在 mysql v8 中,这些表被移动到 performance 模式,参见 mysql manual .

关于MySQL 8 Select语句得到 'Last_query_cost',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58581461/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com