Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oejJv-0004BR-ES for pgsql-general@arkaria.postgresql.org; Sat, 01 Oct 2022 20:42:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oejJu-0003vW-9u for pgsql-general@arkaria.postgresql.org; Sat, 01 Oct 2022 20:42:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oejJt-0003sz-TT for pgsql-general@lists.postgresql.org; Sat, 01 Oct 2022 20:42:45 +0000 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oejJm-0006BD-Kt for pgsql-general@lists.postgresql.org; Sat, 01 Oct 2022 20:42:45 +0000 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-132555b7121so172776fac.2 for ; Sat, 01 Oct 2022 13:42:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=LxK7clKi25UPajHneI21niCEt+780TQjAOzF12tlrBc=; b=WH2VB+MPmNgUsQBDqtM+anvwFXB4jl5xLbGYWbQloOI75bXK4zLlMaCi3AkhGe/oWg yp7biogtr+q0zv5F6rDQVQDUXey08XxEGL0HEiKok+8rU2vnVXWV0guvWDQeqAeKcmrL O2z7UMMxTwcMUTJ9mLuMMDTrLnqZYTdtBJAWoi7Mdtak8Zqa/vdESu1SqG82KsTjvKmg 0v5Q07lM472TpfE3CnQAfTTzMm1wm+GX9/JXjx6IJpvPyxGf62KIqbdrcliTzOlSLo7b pfZrzVN0klTWE5kNUVivGw9c4MvCHKzzdhUs6AlRj6dkMMcocQ99XX75emo6xH8ML02W IWsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=LxK7clKi25UPajHneI21niCEt+780TQjAOzF12tlrBc=; b=Mp0EIvw7euyZxjcxlVbIIgzC0Tp6pOp5REXT/0BzYiyRkuqHb6nUQLmXNyxL57KmXW 9+ZykW5VhtkhBaERqF/qFKLgkRiQOS+7VrvXxDgfBSfnzmY0zxeP4Not2xDnzUlsB467 A3F4Q/KaWJHZ2qq9WppAMPqjBLvqgclMRDz7bD2n1Tg50umvThXxCjUywwYkfZiUO0e3 RGqxfSq6eBhYUwye0OYBoAZWYTWXyflzAiY2XAKFf+3hNcaL5JQOH0TldEsZ8bHiumnb NNGj5ipIpDT29E9u2C9t2qMl1pxpuiD/AW2o3l17r85A4A+l2Lfps7eoVIbXL46uEKNc Lifw== X-Gm-Message-State: ACrzQf2dluiIGC7r7d4CC85OpUZKo8b9FDL8xLkln9DLaM9HZZq17I20 lfGWjUjvTpDCb7H8YJp68PXgxCtuu2M= X-Google-Smtp-Source: AMsMyM66BYU4foEBTf/HvviVGJQym4J8s7BQCeVju3Xe/HFW98Em/tIanymhi81JfIrmRwio2gZ7Kg== X-Received: by 2002:a05:6870:1711:b0:131:cc05:d883 with SMTP id h17-20020a056870171100b00131cc05d883mr1961129oae.32.1664656956484; Sat, 01 Oct 2022 13:42:36 -0700 (PDT) Received: from [192.168.88.10] (ip68-11-68-85.no.no.cox.net. [68.11.68.85]) by smtp.googlemail.com with ESMTPSA id 6-20020aca0506000000b003509cc4ad4esm1395941oif.39.2022.10.01.13.42.35 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 01 Oct 2022 13:42:35 -0700 (PDT) Message-ID: <692ae306-064d-d7c4-3f82-47a3bec6a29a@gmail.com> Date: Sat, 1 Oct 2022 15:42:35 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: Example code Re: Singleton SELECT inside cursor loop Content-Language: en-US To: pgsql-general@lists.postgresql.org References: From: Ron In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/1/22 14:54, Christoph Moench-Tegeder wrote: > ## Ron (ronljohnsonjr@gmail.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.