Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 23A2F63316B for ; Mon, 2 Nov 2009 00:24:58 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 12914-10 for ; Mon, 2 Nov 2009 04:24:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mail.postgresql.org (Postfix) with ESMTP id E96F8632C19 for ; Mon, 2 Nov 2009 00:24:49 -0400 (AST) Received: by bwz5 with SMTP id 5so6005860bwz.3 for ; Sun, 01 Nov 2009 20:24:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=YfwWTeFCMqOMnVzd50CoSx7NmQqy1Sk+7eRE2B+MQPM=; b=NklAWJCgvNvGmjqYC2/zj+byC+ZCqSs/tNBqTCh2iDP2vNb9ZgpFzoOuODyxzZMHpz q5ij3H5CVxzkt0bqCfpZbLWuDmoiP84/FGc4x/wk9Z8jaqaxBzeqirKyhg6AhGJzmpJu Y2FxoXuiGccn4T1SHCc9Ehp2cFQ+MrELhfEgY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=s+4klNrw8AXeQTBiAeu64Q2m1GNnrUwJM/p3aU9OZexmMrTwNpQLBVK6cO31V/DZ1h L+/KSxMH8fY1TsCaGbLmU1KTHDJCYjVLHyRjbeb/JaPQfDXKa+/D4+NBJHYudao43KVT sxuz2M2gC8Krv6Wf1sfH0xlbNMmmjdLBDWI9c= MIME-Version: 1.0 Received: by 10.239.139.4 with SMTP id r4mr439881hbr.199.1257135888004; Sun, 01 Nov 2009 20:24:48 -0800 (PST) In-Reply-To: <234efe30911010853k1908b6a6kdb1ebcdbc4c22691@mail.gmail.com> References: <234efe30911010651k6cf3d398t9d61e560d57b52b7@mail.gmail.com> <162867790911010656m37b315dbp41761a014745b9e4@mail.gmail.com> <234efe30911010853k1908b6a6kdb1ebcdbc4c22691@mail.gmail.com> Date: Sun, 1 Nov 2009 23:24:47 -0500 Message-ID: <603c8f070911012024q26bd2b2aw9da2cef4d8face0f@mail.gmail.com> Subject: Re: Compression in PG From: Robert Haas To: Shaul Dar Cc: Scott Marlowe , Pavel Stehule , pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200911/8 X-Sequence-Number: 36176 On Sun, Nov 1, 2009 at 11:53 AM, Shaul Dar wrote: > I am aware of the TOAST mechanism (actually complained about it in this > forum...). The text fields I have are below the limits that trigger this > mechanism, and also I may want to compress specific fields, not all of them. > And also I have performance concerns as TOAST splits tables and can > potentially cause a performance hit on queries. > > My question is if PG can compress smaller text fields e.g 0.5-1KB, or must I > do this outside PG? The manual explains the behavior of the system fairly clearly. You should read it through carefully, since it doesn't seem that you aware of all the ins and outs (for example, compression and external storage can be configured independently of one another, and on a per-column basis). If it doesn't seem like the behavior you want, then it is likely that you are trying to solve a different problem than the one that TOAST is designed to solve. In that case, you should tell us more about what you're trying to do. The only reason I can think of for wanting to compress very small datums is if you have a gajillion of them, they're highly compressible, and you have extra CPU time coming out of your ears. In that case - yeah, you might want to think about pre-compressing them outside of Pg. If you're doing this for some other reason you could probably get some better advice if you explain what it is... ...Robert