Re: psql is hanging

From: Chris Mair <chris(at)1006(dot)org>
To: John Smith <localdevjs(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: psql is hanging
Date: 2018-11-30 16:05:09
Message-ID: 285ebefdfdbaffaae8812c5ed1e695ef@smtp.hushmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> We're kind of pulling out our hair here, any ideas?

You might try issuing the command

analyze;

right *before* the command that hangs.

The rationale behind this idea is that your script changed data
and the "hung" command uses a wrong plan based on outdated statistics.
By the time you run it manually it would be fast again, because in the
mean time the statistics have been updated automatically.

Analyze forces an immediate update of the statistics on the whole
database.

This can by itself take some time according to size of the
database. If my idea works, you can then further optimize by
doing analyze only on the changed tables.

Bye,
Chris.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Mair 2018-11-30 16:10:39 Re: psql is hanging
Previous Message Adrian Klaver 2018-11-30 16:02:27 Re: psql is hanging