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 1lmhqS-0005N7-9U for pgsql-performance@arkaria.postgresql.org; Fri, 28 May 2021 19:08:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lmhqP-000146-Q5 for pgsql-performance@arkaria.postgresql.org; Fri, 28 May 2021 19:08:29 +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 1lmhqP-0000zt-I0 for pgsql-performance@lists.postgresql.org; Fri, 28 May 2021 19:08:29 +0000 Received: from relay9-d.mail.gandi.net ([217.70.183.199]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lmhqK-0001q7-V4 for pgsql-performance@lists.postgresql.org; Fri, 28 May 2021 19:08:28 +0000 Received: (Authenticated sender: adsend@dunslane.net) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 92EFBFF804; Fri, 28 May 2021 19:08:21 +0000 (UTC) Subject: Re: AWS forcing PG upgrade from v9.6 a disaster To: "Dean Gibson (DB Administrator)" , pgsql-performance@lists.postgresql.org References: <88dec70b-eb63-0b72-0b5d-253851ef127b@mailpen.com> From: Andrew Dunstan Message-ID: <9fa75894-d3be-e40b-cd89-f641bdf85df0@dunslane.net> Date: Fri, 28 May 2021 15:08:19 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <88dec70b-eb63-0b72-0b5d-253851ef127b@mailpen.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 5/28/21 2:48 PM, Dean Gibson (DB Administrator) wrote: > [Reposted to the proper list] > > I started to use PostgreSQL v7.3 in 2003 on my home Linux systems (4 > at one point), gradually moving to v9.0 w/ replication in 2010.  In > 2017 I moved my 20GB database to AWS/RDS, gradually upgrading to v9.6, > & was entirely satisfied with the result. > > In March of this year, AWS announced that v9.6 was nearing end of > support, & AWS would forcibly upgrade everyone to v12 on January 22, > 2022, if users did not perform the upgrade earlier.  My first attempt > was successful as far as the upgrade itself, but complex queries that > normally ran in a couple of seconds on v9.x, were taking minutes in v12. > > I didn't have the time in March to diagnose the problem, other than > some futile adjustments to server parameters, so I reverted back to a > saved copy of my v9.6 data. > > On Sunday, being retired, I decided to attempt to solve the issue in > earnest.  I have now spent five days (about 14 hours a day), trying > various things, including adding additional indexes.  Keeping the v9.6 > data online for web users, I've "forked" the data into new copies, & > updated them in turn to PostgreSQL v10, v11, v12, & v13.  All exhibit > the same problem:  As you will see below, it appears that versions 10 > & above are doing a sequential scan of some of the "large" (200K rows) > tables.  Note that the expected & actual run times both differ for > v9.6 & v13.2, by more than *two orders of magnitude*. Rather than post > a huge eMail (ha ha), I'll start with this one, that shows an "EXPLAIN > ANALYZE" from both v9.6 & v13.2, followed by the related table & view > definitions.  With one exception, table definitions are from the FCC > (Federal Communications Commission);  the view definitions are my own. > > > Have you tried reproducing these results outside RDS, say on an EC2 instance running vanilla PostgreSQL? cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com