# Ask about PMM Query Analytics features

**URL:** <https://forums.percona.com/t/ask-about-pmm-query-analytics-features/24039>\
**Category:** Percona Monitoring and Management (PMM)\
**Created:** [July 31, 2023, 4:12am UTC](https://forums.percona.com/t/ask-about-pmm-query-analytics-features/24039 "2023-07-31T04:12:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rizky\_Nur\_Zhafirah](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/rizky_nur_zhafirah/32/11864_2.png) [@Rizky\_Nur\_Zhafirah](https://forums.percona.com/u/Rizky_Nur_Zhafirah)\
**Post date:** [July 31, 2023, 4:12am UTC](https://forums.percona.com/t/ask-about-pmm-query-analytics-features/24039/1 "2023-07-31T04:12:44Z")

</div>

Hi PMM team. I want to ask about Examples Tab([Query Analytics - Percona Monitoring and Management](https://docs.percona.com/percona-monitoring-and-management/get-started/query-analytics.html#examples-tab)) in PMM Query Analytics

Does this example only display 1 sample value randomly from the query form?

For example, there is a query like this:

```auto
select * from table where id = ?

```

in a certain time range, the query count is 1000 queries with value id 1 - 1000. will the example tab only display one sample data? or we can choose? for example, we want to display sample data queries that run at certain hours (eg 9.00)

My needs, for example there is a slow query that causes high cpu.  
I can see which queries are slow. But I want to know exactly where what condition makes it slow? Is it when querying a specific id? Is this possible in PMM Query Analytics?

also on [Details Page](https://docs.percona.com/percona-monitoring-and-management/get-started/query-analytics.html#details-tab), there are some of metrics. one of them is `lock_time` : Time to acquire locks

In postgres, there are various types of locks. Can we find out which lock time refers to which lock?

I also try your [demo](https://pmmdemo.percona.com/graph/d/pmm-qan/pmm-query-analytics?var-environment=Prod&var-cluster=All&var-replication_set=All&var-database=All&var-schema=All&var-node_name=All&var-service_name=All&var-client_host=All&var-username=All&var-service_type=All&var-node_type=All&var-city=All&var-az=All&var-interval=auto&columns=%5B%22load%22,%22num_queries%22,%22query_time%22%5D&group_by=queryid&filter_by=3a9bfd69f3809131b0fcf8b8e7c8181d&order_by=-load&from=now-12h&to=now&dimensionSearchText=sbtest1&page_number=1&page_size=25&totals=false&query_selected&details_tab=details)  
there is a metric called Number of Queries with errors. can we know what error that query got?  
 ![Screenshot 2023-07-26 at 10.53.59](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/a/af62db8d2d44234037b965b638a6b4e3c26f8248.png)

Really appreciate your answer. Thanks in advance

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [July 31, 2023, 4:11pm UTC](https://forums.percona.com/t/ask-about-pmm-query-analytics-features/24039/2 "2023-07-31T16:11:23Z")

</div>

> [@Rizky\_Nur\_Zhafirah](#):
>
> Does this example only display 1 sample value randomly from the query form?

Yes.

> [@Rizky\_Nur\_Zhafirah](#):
>
> In postgres, there are various types of locks. Can we find out which lock time refers to which lock?

In MySQL/InnoDB, there’s only row locks. So this is time to acquire all necessary row locks for the query execution.

> [@Rizky\_Nur\_Zhafirah](#):
>
> there is a metric called Number of Queries with errors. can we know what error that query got?

No, because MySQL doesn’t store that information. The error information is returned to the client and the client should handle it (ie: the application). In the case of Foreign Key violation, or Deadlock, this information is stored in the output of `SHOW ENGINE INNODB STATUS` but is short-lived. You would need to use pt-deadlock-logger and pt-foreign-key-logger (part of the Percona Toolkit) to log this information on a regular basis. But again, those errors are returned to the app so the app should be logging the info appropriately.

---

<div class="post-metadata">

**Author:** ![Rizky\_Nur\_Zhafirah](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/rizky_nur_zhafirah/32/11864_2.png) [@Rizky\_Nur\_Zhafirah](https://forums.percona.com/u/Rizky_Nur_Zhafirah)\
**Post date:** [August 1, 2023, 4:31am UTC](https://forums.percona.com/t/ask-about-pmm-query-analytics-features/24039/3 "2023-08-01T04:31:12Z")

</div>

hi matthewb, thanks for your information

> [@matthewb](#):
>
> In MySQL/InnoDB, there’s only row locks. So this is time to acquire all necessary row locks for the query execution.

how about in postgres? is lock\_time metric also available in postgres? if yes, does it show lock\_time in general? or is there lock information that is handled when a lock occurs?

> [@matthewb](#):
>
> No, because MySQL doesn’t store that information. The error information is returned to the client and the client should handle it (ie: the application). In the case of Foreign Key violation, or Deadlock, this information is stored in the output of `SHOW ENGINE INNODB STATUS` but is short-lived. You would need to use pt-deadlock-logger and pt-foreign-key-logger (part of the Percona Toolkit) to log this information on a regular basis. But again, those errors are returned to the app so the app should be logging the info appropriately.

how about in postgres? is it same?

thanks in advance

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [August 1, 2023, 6:51pm UTC](https://forums.percona.com/t/ask-about-pmm-query-analytics-features/24039/4 "2023-08-01T18:51:46Z")

</div>

> [@Rizky\_Nur\_Zhafirah](#):
>
> how about in postgres?

I don’t know, I’m not a pgsql guy 😉 I’ll see if I can get one of our PG experts to comment here.
