How to find MySQL temporary table storage engine

后端 未结 2 1130
有刺的猬
有刺的猬 2021-01-16 20:57

Hi I am working with Temporary table and I would like to know the temporary table storage Engine (InnoDB, MyISAM .... )

I am using the following code to find out bu

相关标签:
2条回答
  • 2021-01-16 21:33

    You will want to search the temporary tables store information_schema.temporary_tables or the global temporary table store information_schema.global_temporary_tables.

    Try

    `SELECT ENGINE FROM information_schema.temporary_tables WHERE TABLE_SCHEMA='test' AND `TABLE_NAME`='temporary_table'`
    
    0 讨论(0)
  • 2021-01-16 21:38

    Unfortunately:

    Currently, the [INFORMATION_SCHEMA.]TABLES table does not list TEMPORARY tables.

    I would advise parsing the result of SHOW CREATE TABLE temporary_table;

    To extract only the ENGINE of this return value:

    $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'];
    
    0 讨论(0)
提交回复
热议问题