跳至內容
選單
此問題已被標幟
1 回覆
407 瀏覽次數

Hi, please help to have a look about this issue on my odoo server running for 5 years.

It seems that postgres process consumes high CPU recently, and the CPU usage is reached to 100% all the time. Here is the htop result below, PID 12765 of postgres process is 67.3%, but nobody is using the server.


Try to fix:

  1. run this command:
sudo -u postgres psql -c " SELECT pid,
       now() - query_start AS duration,
       left(query,120) AS sql,
       state FROM pg_stat_activity WHERE state='active'
ORDER BY query_start;"


and showing this below, but i don't know how to fix it. please help.

頭像
捨棄
最佳答案

Hi,

The root cause appears to be a long-running PostgreSQL query on the sale_order_line and sale_order tables. This query is consuming a large amount of CPU resources, which explains why the system is consistently reaching 100% CPU. The below steps may help you to solve the problem:

The below query will list all active queries and focus only on the one that has been running unusually long:

SELECT pid,

       now() - query_start AS duration,

       usename,

       application_name,

       client_addr,

       state,

       left(query,150) AS query

FROM pg_stat_activity

WHERE state = 'active'

ORDER BY query_start;


Hope it helps

頭像
捨棄