# Unable to get query in Query Analytics (MYSQL) taking time more than 5min

**URL:** <https://forums.percona.com/t/unable-to-get-query-in-query-analytics-mysql-taking-time-more-than-5min/18706>\
**Category:** Other MySQL® Questions\
**Tags:** mysql, percona\
**Created:** [November 22, 2022, 8:03am UTC](https://forums.percona.com/t/unable-to-get-query-in-query-analytics-mysql-taking-time-more-than-5min/18706 "2022-11-22T08:03:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sawan\_singh](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sawan_singh/32/8260_2.png) [@sawan\_singh](https://forums.percona.com/u/sawan_singh)\
**Post date:** [November 22, 2022, 8:03am UTC](https://forums.percona.com/t/unable-to-get-query-in-query-analytics-mysql-taking-time-more-than-5min/18706/1 "2022-11-22T08:03:21Z")

</div>

Hi, I am unable to get few query in Query Analytics. I have created a script which calculates the bad query and in results gives the querry taking more than 5 minutes, but in PMM those query were supposed to be QAN. I want those queries to be displayed in QAN. For better understanding i have attached the ScreenShots.

 ![Screenshot](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/f/f922fd8891e172b6c91dca74b2d122d9f5c0b2df.jpeg)

---

<div class="post-metadata">

**Author:** ![Pep\_Pla](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/pep_pla/32/9735_2.png) [@Pep\_Pla](https://forums.percona.com/u/Pep_Pla)\
**Post date:** [November 22, 2022, 10:37am UTC](https://forums.percona.com/t/unable-to-get-query-in-query-analytics-mysql-taking-time-more-than-5min/18706/2 "2022-11-22T10:37:22Z")

</div>

Hi @sawan_singh,

Thank you for being an active part of the community.  
Could you execute the following command on the database server:

```auto
pmm-admin status

```

This should tell us if the `slow log agent` is running.  
Also check the following variables:

```auto
show global variables like '%slow%';
show global variables like 'long%';
show global variables like 'log_queries%';

```

This will tell us your slow log configuration.

Post this information back here and we will try to find out what’s happening.

Thank you!

Pep

---

<div class="post-metadata">

**Author:** ![sawan\_singh](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sawan_singh/32/8260_2.png) [@sawan\_singh](https://forums.percona.com/u/sawan_singh)\
**Post date:** [November 23, 2022, 11:19am UTC](https://forums.percona.com/t/unable-to-get-query-in-query-analytics-mysql-taking-time-more-than-5min/18706/3 "2022-11-23T11:19:32Z")

</div>

Thanks For replying @Pep_Pla  
I have ran these queries, below attached Snapshots were the output of the query you to run.  
Thank You  
Sawan  
show global variables like ‘%slow%’;

 ![image_2022_11_23T10_42_35_025Z](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/a/a58a7bf32809790c806fd11aee18c4d593240603.png)

show global variables like ‘long%’;  
 ![image_2022_11_23T10_43_00_049Z](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/5/5299530941368bb90f30a995b8b819a2c56f6a6c.png)

show global variables like ‘log\_queries%’;  
 ![image_2022_11_23T10_43_35_986Z](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/e/e02f5da25c16d30ccd5974ed3703a66c43d7faa7.png)

---

<div class="post-metadata">

**Author:** ![Pep\_Pla](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/pep_pla/32/9735_2.png) [@Pep\_Pla](https://forums.percona.com/u/Pep_Pla)\
**Post date:** [November 23, 2022, 4:35pm UTC](https://forums.percona.com/t/unable-to-get-query-in-query-analytics-mysql-taking-time-more-than-5min/18706/5 "2022-11-23T16:35:47Z")

</div>

Hi, this is still missing:

> [@Pep\_Pla](#):
>
> Could you execute the following command on the database server:
> 
> ```auto
> pmm-admin status
> 
> ```

Looks like the Slow Query Log is not enabled. We need to make sure that the Performance schema is enabled and configured:

From the PMM documentation, the following should be enabled. Could you share with us the value of these variables?

| Variable | Value | Description |
| --- | --- | --- |
| performance\_schema | ON | Enables Performance Schema metrics. This is the default in MySQL 5.6.6 and higher. |
| performance-schema-instrument | ‘statement/%=ON’ | Configures Performance Schema instruments. |
| performance-schema-consumer-statements-digest | ON | Configures the statements-digest consumer. |
| innodb\_monitor\_enable | all | Enables InnoDB metrics counters. |

Also, check that the PMM user has the process privilege. Use `show grants for <pmm-user>;`

Thanks,

Pep

---

<div class="post-metadata">

**Author:** ![sawan\_singh](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sawan_singh/32/8260_2.png) [@sawan\_singh](https://forums.percona.com/u/sawan_singh)\
**Post date:** [January 6, 2023, 12:50pm UTC](https://forums.percona.com/t/unable-to-get-query-in-query-analytics-mysql-taking-time-more-than-5min/18706/6 "2023-01-06T12:50:27Z")

</div>

hi @Pep_Pla hope you are doing well,  
pmm-admin status (output of the command)

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/b/b48c033ffb2a9e038b5e3e9a0d0ba2943f515c67.png)  
we are using AWS RDS for mysql.  
performance\_schema is off

grants for the user we have used  
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON _._  
Thanks,  
Sawan
