skip to Main Content

Pgsql Version : 10.21.

We are consistently receiving below message in the pg_log.

‘using stale statistics instead of current ones because the stats collector is not responding’

Moreover, we have noticed significant slowdowns in DB queries occurring randomly.

Anybody faced this kind of issue and Kindly suggestion any solution for this? Thank you.

Note : As mentioned in this post restarting is not possible, since this application is in the production setup.

2

Answers


  1. Chosen as BEST ANSWER

    Thanks for your response.

    I once had a case where the statistics collector listened on IP v6, but IPv6 was disabled later during the startup process.

    Verified this case. Only IPV4 is enabled on the Machine.

    If the statistics collector is not working, PostgreSQL does not gather statistics that drive autovacuum and autoanalyze, so it is not surprising if your queries perform badly.

    This gave us some insights to us. We noticed that Once we get the below message in the pg_logs the very next query execution got delayed for 3 minutes. So we tried to execute the query again it got executed only in 2 Seconds. Will it be due to the stats collector being updated during the previous query execution?

    'using stale statistics instead of current ones because the stats collector is not responding'

    Also, we are planning to upgrade pgsql version 14.7, will it solve this issue ?


  2. If the statistics collector is not working, PostgreSQL does not gather statistics that drive autovacuum and autoanalyze, so it is not surprising if your queries perform badly. It will also lead to worse problems like table bloat.

    You will have to figure out why the statistics collector is not working. Can you see the process in the process list? If no, that’s the problem. If yes, it may be that you have network problems. I once had a case where the statistics collector listened on IP v6, but IPv6 was disabled later during the startup process. See here for a write-up.

    You will certainly have to restart the database once you have figured out what the problem is and fixed it. The little down time will be the least of your problems.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search