Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YYdeh-00011K-AO for pgsql-bugs@arkaria.postgresql.org; Thu, 19 Mar 2015 16:50:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YYdef-0002X3-74 for pgsql-bugs@arkaria.postgresql.org; Thu, 19 Mar 2015 16:50:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YYdee-0002Wu-7D for pgsql-bugs@postgresql.org; Thu, 19 Mar 2015 16:50:44 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YYdeZ-00014u-NO for pgsql-bugs@postgresql.org; Thu, 19 Mar 2015 16:50:42 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1YYdeW-0004wV-Fl; Thu, 19 Mar 2015 12:50:36 -0400 Date: Thu, 19 Mar 2015 12:50:36 -0400 From: Bruce Momjian To: jbaum@cmcrc.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #11221: pg_restore unusable for expensive matviews Message-ID: <20150319165036.GF6061@momjian.us> References: <20140820021530.2534.43156@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140820021530.2534.43156@wrigleys.postgresql.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On Wed, Aug 20, 2014 at 02:15:30AM +0000, jbaum@cmcrc.com wrote: > The following bug has been logged on the website: > > Bug reference: 11221 > Logged by: Jiri Baum > Email address: jbaum@cmcrc.com > PostgreSQL version: 9.3.5 > Operating system: Linux > Description: > > When restoring a database with expensive materialized views, pg_restore > issues the REFRESH MATERIALIZED VIEW commands without regard to whether > indexes are valid yet or whether autoanalyze has completed. > > As a result, if a materialized view is expensive and relies on indexes > and/or good query plans, the restore will take prohibitively long. > > This is likely to be a common use case, since there's not much point > materializing views that are inexpensive. > > Possible solution: pg_restore should have an option (default?) to wait for > indexes to be valid and run ANALYZE before issuing the REFRESH MATERIALIZED > VIEW commands, either in pg_restore itself or by adding commands to wait for > (relevant or all) indexes to be valid. > > Workaround: Hack stuff up out of the -l and -L options to pg_restore. > > Possibly duplicates: > http://www.postgresql.org/message-id/1403794157042-5809367.post@n5.nabble.com > (not listed on the TODO wiki page) I have added TODO entry: Delay REFRESH MATERIALIZED VIEW until dependent indexes are created o pg_restore unusable for expensive matviews -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs