I currently have a script running and didn't think it would take so long to run, the script is modifying a temporary table.
I know that temporary tables only exist for the current session, but is there anyway to see the data they hold from outside the session?
Reason is that I want to know how long my script is going to keep running for, if I could see the temporary data then I'd be able to figure it out.
mysql> CREATE TEMPORARY TABLE t1 (c1 INT PRIMARY KEY) ENGINE=INNODB; Query INNODB_TEMP_TABLE_INFO to view the temporary table metadata. The TABLE_ID is a unique identifier for the temporary table. The NAME column displays the system-generated name for the temporary table, which is prefixed with “#sql”.
An internal temporary table can be held in memory and processed by the MEMORY storage engine, or stored on disk by the InnoDB or MyISAM storage engine. If an internal temporary table is created as an in-memory table but becomes too large, MySQL automatically converts it to an on-disk table.
The definition cannot refer to a TEMPORARY table, and you cannot create a TEMPORARY view. It makes sense if you think about it. A view should be usable by other sessions. But a temporary table is limited to the current session where it is created.
There's no easy way of doing this I'm afraid.
Temporary tables will be stored in your mysqld's designated temp directory (usually /tmp) and you'll see a set of tables something like:
-rw-rw---- 1 mysql mysql 8724 Nov 29 18:09 #sqldba_5fa70c_12f1.frm
-rw-rw---- 1 mysql mysql 188408 Nov 29 18:09 #sqldba_5fa70c_12f1.MYD
-rw-rw---- 1 mysql mysql 1024 Nov 29 18:09 #sqldba_5fa70c_12f1.MYI
That's a normal set of MyISAM tables defining (in order above) structure, data and index.
This is horribly hacky but I suspect you could copy these tables out into say your test
schema, run a repair on the table and then view it's contents.
If you can gauge the process by the size of the temp table then that could well be a simpler way of analysing what's going on.
Is not possible, you can (however),
log milestone (message, % of completion, number rows processed)
into a temporary file, and use the tail -f log_file
to monitor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With