Re: Hung Query with No Locking Issues - Mailing list pgsql-general

From Tom Lane
Subject Re: Hung Query with No Locking Issues
Date
Msg-id 209710.1683507617@sss.pgh.pa.us
Whole thread Raw
In response to Hung Query with No Locking Issues  ("Michael P. McDonnell" <bzaks1424@gmail.com>)
List pgsql-general
"Michael P. McDonnell" <bzaks1424@gmail.com> writes:
> On Sun, May 7, 2023 at 4:25 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Perhaps an "ANALYZE table_b" in between would help.

> Okay - that worked.
> How did you know that would work? That's incredible.

Well, I guessed ;-) ... but it was a well-educated guess.

The symptoms sounded like you were getting a bad plan choice for
the second query, which is unsurprising if you populate a table
from empty and don't give auto-analyze enough time to collect
some statistics behind your back.

As a solution going forward, I'd recommend adding the ANALYZE
as the last step in the table-populating procedure.

            regards, tom lane



pgsql-general by date:

Previous
From: "Michael P. McDonnell"
Date:
Subject: Re: Hung Query with No Locking Issues
Next
From: Thomas Munro
Date:
Subject: Re: "PANIC: could not open critical system index 2662" - twice