sunningshine
sunningshine

Reputation: 21

How can I determine whether a temporary table exists

How can I determine whether a temporary table exists? I just need to determine, I do not need to create it.

The version is MySQL 5.6.

Upvotes: 0

Views: 3118

Answers (2)

dhyanandra singh
dhyanandra singh

Reputation: 1141

INNODB_TEMP_TABLE_INFO provides information about user-created InnoDB temporary tables that are currently active within the InnoDB instance. It does not provide information about internal InnoDB temporary tables that are used by the optimizer.

so you can check using:

mysql>   SHOW TABLES FROM INFORMATION_SCHEMA LIKE 'INNODB_TEMP%';

Query INNODB_TEMP_TABLE_INFO to view the temporary table metadata.

mysql>   SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO;

More detail is available here

Upvotes: 2

ild flue
ild flue

Reputation: 1361

Dumping the database structure for all tables with no data

mysqldump -d -u someuser -p mydatabase

-d: no data, only structure

-u: username

-p: prompt for password later

Upvotes: 1

Related Questions