Hi Jenny,
> The DTrace probes in MySQL 6.0.4 works fine, and it provide very
> useful online information for query execution time; in addition, it
> provide execution time of queries being replicated to help
> understand the replication load and manage the replication lag.
Oh yeah, it's cool already ;)
> But I think it would be more interesting and useful to add more
> parameters into the probes such as reporting the SQL statement, etc.
> For example, after the following changes, the probes can report the
> execution time for each sql statements:
> "probes.d"
> provider mysql {
> probe update_start(char *);
> probe update_end(char *);
> ...
> }
Absolutely 100% agree. In fact, my suggested patch (which Brian is
reviewing at the moment) adds explicit arguments of different types to
the probes. My probes.d:
probe delete_start(int, char *, char *, char *, char *);
probe delete_finish(int, char *, char *, char *, char *, long);
probe insert_start(int, char *, char *, char *, char *);
probe insert_finish(int, char *, char *, char *, char *, long);
probe select_start(int, char *, char *, char *, char *);
probe select_finish(int, char *, char *, char *, char *, long);
probe update_start(int, char *, char *, char *, char *);
probe update_finish(int, char *, char *, char *, char *, ulong, ulong);
For each each of these, I populate the thread ID, original query, the
user, hostname and database being used.
For each *finish() probe I also include the number of rows deleted/
inserted/returned.
For updates, I return the number of rows found and the number of rows
updated (since the values can be different). That means we can get
output like this:
Op Thread Time ms user at host DB Rows/
f:u Query
update 3 0 root at localhost test
0:0 update t1 set c1=9 where c1=10
update 3 0 root at localhost test
0:0 update t1 set c1=9 where c1=5
update 3 2870 root at localhost test
16384:16384 update t1 set c1=9 where c1=6
select 4 0 root at localhost test
3 show databases
select 4 4 root at localhost test
6 show tables
select 4 2 root at localhost test
1 select count(*) from t1 where c1=6
I have no idea if the patch will go in exactly in this format, but I'm
hoping we can get something fairly close.
MC
--
Martin 'MC' Brown, mc at mcslp.com
Everything MCslp: http://planet.mcslp.com