Re: Example code Re: Singleton SELECT inside cursor loop

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Example code Re: Singleton SELECT inside cursor loop
Date: 2022-10-01 20:42:35
Message-ID: 692ae306-064d-d7c4-3f82-47a3bec6a29a@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/1/22 14:54, Christoph Moench-Tegeder wrote:
> ## Ron (ronljohnsonjr(at)gmail(dot)com):
>
>> The question then is "why am I just now seeing the problem?"  We've been
>> using v12 for two years, and it just happened.
>>
>> The only recent change is that I upgraded it from RDS 12.10 to 12.11 a
>> couple of weeks ago.
> That's correlation, but no proof for causality.

Right.  But it is an important change which happened between job runs (the
22nd of each month).

> Now that you've confirmed that you have indeed a mismatch between generic
> and custom plan, you could compare those (EXPLAIN EXECUTE) and see
> where the generic plan goes wrong.

I'll rerun the EXPLAIN EXECUTE with and without "plan_cache_mode =
force_custom_plan", and attach them in a reply some time soon.

> Otherwise, prime suspects are bad
> statistics (Were stats accurate before the update? How about now?
> Ran VACUUM ANALYZE recently?

VACUUM yesterday at 04:00, and ANALYZE at 09:00, both from a cron job. 
Manually ran ANALYZE last night during the dig into the problem.

> If not, does it improve matters?)

Nope.  Not one bit.

> If would help if you could compare execution plans with plans from
> before the update, but I guess you didn't document those?

So, since ANALYZE did not help.

--
Angular momentum makes the world go 'round.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2022-10-02 04:21:03 Re: Example code Re: Singleton SELECT inside cursor loop
Previous Message Christoph Moench-Tegeder 2022-10-01 19:54:35 Re: Example code Re: Singleton SELECT inside cursor loop