Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 75BAB2E0040 for ; Mon, 14 Apr 2008 21:58:53 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 82910-04 for ; Mon, 14 Apr 2008 21:58:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by developer.postgresql.org (Postfix) with ESMTP id EC8AB2E002E for ; Mon, 14 Apr 2008 21:58:49 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m3F0wmrQ025880; Mon, 14 Apr 2008 20:58:48 -0400 (EDT) To: "Phillip Smith" cc: "'Ryan Wells'" , pgsql-admin@postgresql.org Subject: Re: Slow pg_dump In-reply-to: <004b01c89e86$ebe8fbe0$9b0014ac@wbaus090> References: <004b01c89e86$ebe8fbe0$9b0014ac@wbaus090> Comments: In-reply-to "Phillip Smith" message dated "Tue, 15 Apr 2008 09:26:10 +1000" Date: Mon, 14 Apr 2008 20:58:48 -0400 Message-ID: <25879.1208221128@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/133 X-Sequence-Number: 28897 "Phillip Smith" writes: >> Here's my interpretation of those results: the TOAST tables for >> our image files are compressed by Postgres. During the backup, >> pg_dump uncompresses them, and if compression is turned on, >> recompresses the backup. Please correct me if I'm wrong there. No, the TOAST tables aren't compressed, they're pretty much going to be the raw image data (plus a bit of overhead). What I think is happening is that COPY OUT is encoding the bytea data fairly inefficiently (one byte could go to \\nnn, five bytes) and the compression on the pg_dump side isn't doing very well at buying that back. I experimented a bit and noticed that pg_dump -Fc is a great deal smarter about storing large objects than big bytea fields --- it seems to be pretty nearly one-to-one with the original data size when storing a compressed file that was put into a large object. I dunno if it's practical for you to switch from bytea to large objects, but in the near term I think that's your only option if the dump file size is a showstopper problem for you. regards, tom lane