Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XAUNY-0008Kr-TW for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Jul 2014 01:33:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XAUNY-0001zd-DX for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Jul 2014 01:33:00 +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 1XAUNX-0001zX-QM for pgsql-bugs@postgresql.org; Fri, 25 Jul 2014 01:32:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XAUNT-0007l2-Vm for pgsql-bugs@postgresql.org; Fri, 25 Jul 2014 01:32:58 +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 s6P1Wp5c024592; Thu, 24 Jul 2014 21:32:51 -0400 From: Tom Lane To: joe@tanga.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #11033: 'pg_dump -a' much slower than 'pg_dump' In-reply-to: <20140725001052.16600.86470@wrigleys.postgresql.org> References: <20140725001052.16600.86470@wrigleys.postgresql.org> Comments: In-reply-to joe@tanga.com message dated "Fri, 25 Jul 2014 00:10:52 -0000" Date: Thu, 24 Jul 2014 21:32:51 -0400 Message-ID: <24591.1406251971@sss.pgh.pa.us> 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 joe@tanga.com writes: > I've got a small database that takes about 0.8 seconds to dump with > 'pg_dump' and about 11 seconds to dump with 'pg_dump -a'. > I've narrowed it down to the foreign key constraints in the database, if > those are removed, then 'pg_dump -a' becomes fast again. Given that and the warning messages shown in your followup, a plausible guess is that pg_dump is wasting a lot of time vainly searching for ways to break the circular dependency loops that arise from trying to order the tables in a way that allows them to be restored with foreign key constraints active. However: (a) it seems like it'd take a heck of a lot of FK constraints for that to become a dominant factor, and (b) if that were the explanation, seems like it should not be that hard to make an artificial test case. So I'm thinking there's some other contributing factor you haven't shown us. > I can't come up with an artificial test case. I can reproduce it using our > company's db schema. I don't want to publicly post that schema to the > mailing list, but I'd be happy to send the schema that shows the problem to > someone privately. I'd be willing to take a look, but it's not clear that there is any easy fix, and TBH I'm not sure that this case is worth spending a lot of time on. As the warning messages are telling you, a --data-only dump is of limited value when you've got circular foreign key references. What are you intending to do with the dump anyway? regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs