[Maria-developers] Audit plugin and qc_info plugin - MDEV-4682
![](https://secure.gravatar.com/avatar/33fb5c08359d9d82c9358b7775aab4b9.jpg?s=120&d=mm&r=g)
Hi guys, i put some fields in qc_info plugin https://mariadb.atlassian.net/browse/MDEV-4581 the second part was add some others informations (stats): https://mariadb.atlassian.net/browse/MDEV-4682 i was reading the "response_time_distribution" of percona, patch at https://mariadb.atlassian.net/browse/MDEV-4568 could i use the audit plugin to implement MDEV-4682? what i need is: 1)know if the query was executed with/without query cache 2)know the time expend (lock time, and total time) to execute the query (first execution) 3)know the time expend with query cache hit 4) both (3) and (2) don't include time of network packages, just server side times... is it possible? any idea how could i implement it? i didn't write a audit plugin yet =( well.. time to learn =D thanks guys! -- Roberto Spadim
![](https://secure.gravatar.com/avatar/39b623a1559cf9c69ac3d9d4fb44e7fe.jpg?s=120&d=mm&r=g)
Hi, Roberto! On Aug 15, Roberto Spadim wrote:
Hi guys, i put some fields in qc_info plugin https://mariadb.atlassian.net/browse/MDEV-4581 the second part was add some others informations (stats): https://mariadb.atlassian.net/browse/MDEV-4682
i was reading the "response_time_distribution" of percona, patch at https://mariadb.atlassian.net/browse/MDEV-4568
could i use the audit plugin to implement MDEV-4682?
what i need is: 1)know if the query was executed with/without query cache
There's no API for that. Perhaps, a plugin can get this information by declaring MYSQL_SERVER, and looking at THD fields that are normally used when a query is executed. Like, if they're NULL, the query was in the query cache. Some hacks like that are, probably, possible.
2)know the time expend (lock time, and total time) to execute the query (first execution)
no lock time. query time can be calculated by measuring the time between MYSQL_AUDIT_GENERAL_LOG and MYSQL_AUDIT_GENERAL_STATUS.
3)know the time expend with query cache hit
pardon me?
4) both (3) and (2) don't include time of network packages, just server side times...
is it possible? any idea how could i implement it? i didn't write a audit plugin yet =( well.. time to learn =D
Audit API is very simple, you won't have any problems with it :) Regards, Sergei
![](https://secure.gravatar.com/avatar/33fb5c08359d9d82c9358b7775aab4b9.jpg?s=120&d=mm&r=g)
Hi Sergei! :D
2013/8/18 Sergei Golubchik
Hi, Roberto!
On Aug 15, Roberto Spadim wrote:
Hi guys, i put some fields in qc_info plugin https://mariadb.atlassian.net/browse/MDEV-4581 the second part was add some others informations (stats): https://mariadb.atlassian.net/browse/MDEV-4682
i was reading the "response_time_distribution" of percona, patch at https://mariadb.atlassian.net/browse/MDEV-4568
could i use the audit plugin to implement MDEV-4682?
what i need is: 1)know if the query was executed with/without query cache
There's no API for that. Perhaps, a plugin can get this information by declaring MYSQL_SERVER, and looking at THD fields that are normally used when a query is executed. Like, if they're NULL, the query was in the query cache. Some hacks like that are, probably, possible.
i hacked the THD... check the patch at https://mariadb.atlassian.net/browse/MDEV-4904 ((thd->query_plan_flags & QPLAN_QC) !=0?1:0 ) if ==1 query cache used, if not query cache not used =]
2)know the time expend (lock time, and total time) to execute the query (first execution)
no lock time. query time can be calculated by measuring the time between MYSQL_AUDIT_GENERAL_LOG and MYSQL_AUDIT_GENERAL_STATUS.
nice, i was looking the "query_response_time_plugin", and it do something similar, just the start query time and the start lock time are "recorded" (saved in a THD variable) by server, maybe we could add a end time to make stats easier?
3)know the time expend with query cache hit
pardon me?
hehe i did this in https://mariadb.atlassian.net/browse/MDEV-4682 it's the time between the start of query execution and end_of_result function i use it in mdev-4682 to know how many time we lost in query cache, that's interesting to know the difference from query time and query cache 'boost' (query time * query cache hits)-(SUM OF query cache hits time) = total time we boost with cache
4) both (3) and (2) don't include time of network packages, just server side times...
is it possible? any idea how could i implement it? i didn't write a audit plugin yet =( well.. time to learn =D
Audit API is very simple, you won't have any problems with it :)
reading the plugin i think it's possible :) sorry i didn't read it before
Regards, Sergei
thanks!!! :D
-- Roberto Spadim
participants (2)
-
Roberto Spadim
-
Sergei Golubchik