Hi All,
We are performing a load test (Java application); we don’t see any high CPU queries or slow queries, but Postgres processes (around 20 processes) are simultaneously taking 100% CPU. We are unable to figure out the issue, how to find a solution, why, and which queries or any other are taking that many CPU’s.
Here are the env details.
PostgreSQL DB Version: 12
PostgreSQL DB Server CPU’s: 6
PostgreSQL DB Server RAM: 8 GB
Number of API’s: 6
Per API parallel threads: 10
Run these two queries while it’s under load
select * from pg_stat_activity
select * from pg_locks
Make certain pg_stat_statements is installed and query the view.
And finally, log all postgres messages. Make certain you’ve updated the settings that you can adequate information.
Hi @Robert_Bernier
I have installed the pg_stat_statements using PMM, and we are monitoring the queries. But I could not find any queries that are causing high CPU usage.
I did not find any locking queries as well.
Hello Naresh,
You can identify the queries that are causing high CPU usage by using the pg_stat_activity view. Take the Process IDs that are consuming high CPU at the operating system level and query the pg_stat_activity view as shown below:
select * from pg_stat_activity where pid='<process ID>';
Thanks.
1 Like
Thanks @Shivam_Dhapatkar
I will check and let you know.