简体   繁体   English

如何找到MySQL临时表存储引擎

[英]How to find MySQL temporary table storage engine

Hi I am working with Temporary table and I would like to know the temporary table storage Engine (InnoDB, MyISAM .... ) 嗨,我正在使用临时表,我想知道临时表存储引擎(InnoDB,MyISAM ....)

I am using the following code to find out but it is not showing me the storage Engine. 我正在使用以下代码来查找,但未向我显示存储引擎。

$engine="SELECT ENGINE FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND `TABLE_NAME`='temporary_table'";
$export = mysql_query($engine, $connection) or die ("Sql error : ".mysql_error());
while ($row = mysql_fetch_array($export, MYSQL_BOTH)) {
    printf ("ENGINE: %s ---", $row[0]);
}

But the same code is working when I try to find the storage engine for Physical tables in my DB? 但是,当我尝试在数据库中查找物理表的存储引擎时,相同的代码是否起作用?

Any Help is much appreciated.!! 任何帮助深表感谢。!! Thank you. 谢谢。

Unfortunately : 不幸的是

Currently, the [INFORMATION_SCHEMA.]TABLES table does not list TEMPORARY tables. 当前,[INFORMATION_SCHEMA。] TABLES表未列出TEMPORARY表。

I would advise parsing the result of SHOW CREATE TABLE temporary_table; 我建议解析SHOW CREATE TABLE temporary_table;的结果SHOW CREATE TABLE temporary_table;

To extract only the ENGINE of this return value: 要仅提取此返回值的ENGINE:

$rset = mysql_query('SHOW CREATE TABLE temporary_table;')
$row = mysql_fetch_array($rset, MYSQL_BOTH);
preg_match('/ENGINE\=(?P<engine>\w+)/', $row[1], $matches);
echo $matches['engine'];

You will want to search the temporary tables store information_schema.temporary_tables or the global temporary table store information_schema.global_temporary_tables . 您将要搜索临时表存储information_schema.temporary_tables或全局临时表存储information_schema.global_temporary_tables

Try 尝试

`SELECT ENGINE FROM information_schema.temporary_tables WHERE TABLE_SCHEMA='test' AND `TABLE_NAME`='temporary_table'`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM