When adding a custom query to the MySQL conf.yaml, each table referenced must have the database qualified. This is done by prepending the table with its database name in the following format:
SELECT*FROMdatabase_name.table_nameWHERE...
If you omit the database name, the Agent fails to run the query with the error: No database selected.
The names applied to your query metrics are taken as provided (there are no prepends). For example, your metric name could be: myapp.custom_query.test.
By default your metrics are collected by the MySQL check every 15-20 seconds. To query these metrics at a different frequency, reduce the frequency of the entire MySQL check (this affects the frequency of your general mysql.* metrics), or run a custom scheduled CRON script to submit metrics with the API or DogStatsD.
Running a large number of custom queries from the MySQL check can delay other Agent checks. If you need to collect metrics from a large number of custom MySQL queries, run a custom scheduled CRON script to submit metrics with the API or DogStatsD.