Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1exwoV-000426-MC for pgsql-performance@arkaria.postgresql.org; Mon, 19 Mar 2018 15:35:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1exwoU-0002zp-BJ for pgsql-performance@arkaria.postgresql.org; Mon, 19 Mar 2018 15:35:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1exwoU-0002ze-3i for pgsql-performance@lists.postgresql.org; Mon, 19 Mar 2018 15:35:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1exwoQ-0000cn-Vm for pgsql-performance@postgresql.org; Mon, 19 Mar 2018 15:35:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w2JFZ0Z3031891; Mon, 19 Mar 2018 11:35:00 -0400 From: Tom Lane To: David Osborne cc: pgsql-performance@postgresql.org Subject: Re: Slow performance after restoring a dump In-reply-to: References: Comments: In-reply-to David Osborne message dated "Mon, 19 Mar 2018 15:13:37 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31889.1521473700.1@sss.pgh.pa.us> Date: Mon, 19 Mar 2018 11:35:00 -0400 Message-ID: <31890.1521473700@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk David Osborne writes: > Hi, I was wondering if someone could help us work out why this query is so > slow. > We've just dumped a database (Postgresql 9.1) and restored it to a new > instance (AWS RDS 9.6) (via pg_dump, restored to psql) The first question people will ask is did you re-ANALYZE the new database? pg_dump doesn't take care of that for you, and auto-analyze might not think it needs to process the smaller tables. regards, tom lane