views:

13

answers:

2

Hello everyone. I want to copy profiling data to a table I create in MySql. I want the table to contain the exact data that I get from the command SHOW PROFILES;

For example, if I have this: mysql> show profiles;
+----------+------------+--------------------------------+
| Query_ID | Duration | Query |
+----------+------------+--------------------------------+
| 16 | 0.00059700 | select * from imprumuturi |
| 17 | 0.00042050 | select * from imprumuturi |
| 18 | 0.00042000 | select * from imprumuturi |
| 19 | 0.00042950 | select * from imprumuturi |
| 20 | 0.00048050 | select * from imprumuturi |
+----------+------------+--------------------------------+
5 rows in set (0.00 sec)

I will create a table that has 3 columns (queryid,duration and query), and I need a command that will copy those 5 rows from "SHOW PROFILES;" to my table.

insert into table (show profiles); does not work

I need it to be done in MySql alone, no other tools/patches.

A: 
insert into t (select * from information_schema.profiling)
jspcal
That will not get me the data I want.Your command will insert the different stages and their duration for all queries (I will get many lines per query, and I won't know the query text).I want these columns: Query ID, Duration and Query.And I need one line per query. Just like in my example.
Ove
+1  A: 

INSERT INTO t (SELECT some columns FROM INFORMATION_SCHEMA.PROFILING)

Tor Valamo
What is the column that gets me the query text?
Ove
I don't know because I don't have profiling enabled so I can't see it. You need to look at your profiling table "SELECT * FROM PROFILING LIMIT 1" to find out.
Tor Valamo
I have done that before posting here, but there isn't a column that shows me the query text :|I only have the query id, and I need to get the text. If I had that, this would be solved.
Ove
I'm guessing it's related to some sort of log, where QueryID is the ID used there, but I can't figure out where. Good luck in your search. :)
Tor Valamo
Please let us know if you find it. It's good for the SO archives.
Tor Valamo
I will, but I am beginning to think this isn't possible (yet)... I have posted a question in the MySQL forums
Ove