From: Chris Mair <chris@1006.org>
To: John Smith <localdevjs@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: psql is hanging
Date: Fri, 30 Nov 2018 17:05:09 +0100
Message-ID: <285ebefdfdbaffaae8812c5ed1e695ef@smtp.hushmail.com> (raw)
In-Reply-To: <CAK6G+57yG5W+ZSShNjHMKjKPpYB-enTaWKcwC5k5wa4Oew5zXA@mail.gmail.com>
References: <CAK6G+57yG5W+ZSShNjHMKjKPpYB-enTaWKcwC5k5wa4Oew5zXA@mail.gmail.com>
> 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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: chris@1006.org, localdevjs@gmail.com
Subject: Re: psql is hanging
In-Reply-To: <285ebefdfdbaffaae8812c5ed1e695ef@smtp.hushmail.com>
References: <CAK6G+57yG5W+ZSShNjHMKjKPpYB-enTaWKcwC5k5wa4Oew5zXA@mail.gmail.com> <285ebefdfdbaffaae8812c5ed1e695ef@smtp.hushmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox