How to create a custom QAN dashboard{Query Analytics}

Hi All,

How can we create custom QAN dashboard? We would like to create a dash board like Top 10 slow queries or top 20 slow queries in the custom dashboard.

Hi @Naresh9999

Please take a look at the next blogpost.

The dashboard is present on our demo site.

Hi @Vadim_Yalovets

Thanks for the quick help.

When I am trying to run the query then I am getting the below error.
Code: 60, e.displayText() = DB::Exception: Table default.undefined doesn’t exist (version 21.3.20.1 (official build))

Could you check a generated SQL request?

Screenshot 2023-03-20 at 12.58.05

Hi @Vadim_Yalovets

Here is the generated sql output.

No table has been specified in your case.
It has to be pmm.metrics

e.g.

@Vadim_Yalovets

Sorry its my bad, Thanks for the help.

One last information, I am unable to view or copy the full query from the dashboard. Is there a way we can get full query details from the below Slowest Queries dashboard.

Example: we are seeing end of the query with dots like below.

coalesce(msi.regstn_src_cd,msi2.regstn_src_cd) as buyer_regstn_src_cd, m.crm_id as crm_id, …

SELECT
    fingerprint,
    sum(num_queries)/($__to-$__from)*1000 QPS,
    sum(m_query_time_sum)/sum(m_query_time_cnt)*1000 as Latency_ms,
    sum(m_rows_examined_sum)/sum(m_rows_sent_sum) as Rows_exam_per_sent
FROM $table
WHERE $timeFilter
GROUP BY fingerprint
ORDER BY Latency_ms desc limit 20

@Vadim_Yalovets

I already tried the above query but still I am getting half/partial queries instead of full queries.
I am actually using mysql slowlog source as perfschema.