# Ask about PMM Query Analytics features

**URL:** <https://forums.percona.com/t/ask-about-pmm-query-analytics-features/23875>\
**Category:** PMM 2.x\
**Created:** [July 25, 2023, 4:26am UTC](https://forums.percona.com/t/ask-about-pmm-query-analytics-features/23875 "2023-07-25T04:26:44Z")\
**Posts on this page:** 5\
**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 25, 2023, 4:26am UTC](https://forums.percona.com/t/ask-about-pmm-query-analytics-features/23875/1 "2023-07-25T04:26:44Z")

</div>

Hi percona team. I’m doing research for tools that works similar like solarwinds/vividcortex in term of query profiling and monitoring. My need is monitoring tools for postgres and mysql databases

I saw in your [documentation](https://docs.percona.com/percona-monitoring-and-management/get-started/query-analytics.html):

> Query Analytics data retrieval is not instantaneous and can be delayed due to network conditions. In such situations no data is reported and a gap appears in the sparkline.

So i want to ask, can PMM Query Analytics show currently running queries on the db? For example, if there are high cpu on postgres db that caused by a vacuum running on the table. The vacuum is still on going. Can we see the vacuum activity that caused CPU high in the Query Analytics? or it will appear after the vacuum done?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Jan\_Wieremjewicz](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jan_wieremjewicz/32/7324_2.png) [@Jan\_Wieremjewicz](https://forums.percona.com/u/Jan_Wieremjewicz)\
**Post date:** [July 25, 2023, 9:44am UTC](https://forums.percona.com/t/ask-about-pmm-query-analytics-features/23875/2 "2023-07-25T09:44:01Z")

</div>

Hi!  
The simplest answer is that we gather data every 1 minute, but some data like percentiles has more granularity. But the data is pulled every 1 minute by default.

The real time trouble shooting scenario you describe for Vacuum monitoring is currently not possible for PMM Query Analytics as the data for that would not show until the process is done. This is though something we are currently investigating.

---

<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 26, 2023, 3:26am UTC](https://forums.percona.com/t/ask-about-pmm-query-analytics-features/23875/3 "2023-07-26T03:26:54Z")

</div>

Ok jan. Thanks for the info.

I want to ask again about ### Examples Tab[¶](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?

Really appreciate your answer. Thanks in advance

---

<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 26, 2023, 3:56am UTC](https://forums.percona.com/t/ask-about-pmm-query-analytics-features/23875/4 "2023-07-26T03:56:27Z")

</div>

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)

thanks in advance

---

<div class="post-metadata">

**Author:** ![Roma\_Novikov](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/roma_novikov/32/1161_2.png) [@Roma\_Novikov](https://forums.percona.com/u/Roma_Novikov)\
**Post date:** [September 19, 2023, 11:36am UTC](https://forums.percona.com/t/ask-about-pmm-query-analytics-features/23875/5 "2023-09-19T11:36:40Z")

</div>

@Rizky_Nur_Zhafirah let me clarify some of the questions. (it looks like we need some doc changes)

1. Currently, Metrics are able to “survive” network problems and data will be inserted with proper time stamps - [Log in - Percona JIRA](https://jira.percona.com/browse/PMM-7000)  
We also looking to add this for QAN in 2.41 release - [[PMM-8655] Send unsent messages after connection problems - Percona JIRA](https://jira.percona.com/browse/PMM-8655)

2. PMM Already collects “example per data bucket”. So we have a random example for every query in a minute executed by different Hosts and on different Services and planing to present them on UI ([Log in - Percona JIRA](https://jira.percona.com/browse/PMM-3580), no eta for now). If this is critical data - it can be already extracted from PMM database.  
Note: examples and real queries are stored if you use pg\_stat\_monitor plugin on the server. it provides more data than the default one.

3. The timing for different tech are different. for PostgreSQL you can see the list of metrics exposed by the PG plugin at [pg\_stat\_monitor view reference - pg\_stat\_monitor Documentation](https://docs.percona.com/pg-stat-monitor/reference.html#postgresql-15) and if the metric impacting the time -we’ll present it.  
For example, for Mysql we have :lock\_time, innodb\_io\_r\_wait, innodb\_queue\_wait, innodb\_rec\_lock\_wait
