Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
405 Visualizzazioni

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.

Avatar
Abbandona
Risposta migliore

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

Avatar
Abbandona