Ask about PMM Query Analytics features

Hi PMM team. I want to ask about Examples Tab(Query Analytics - Percona Monitoring and Management) 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:

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, 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
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

Really appreciate your answer. Thanks in advance

Yes.

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

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.

hi matthewb, thanks for your information

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?

how about in postgres? is it same?

thanks in advance

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