From: Joe Conway <mail@joeconway.com>
To: Stephan Szabo <sszabo@megazone.bigpanda.com>
Cc: Brian McCane <bmccane@mccons.net>
Cc: pgsql-admin@postgresql.org
Subject: Re: Compression of text fields
Date: Wed, 20 Aug 2003 10:11:23 -0700
Message-ID: <3F43ABBB.20405@joeconway.com> (raw)
In-Reply-To: <20030820092151.H8293-100000@megazone.bigpanda.com>
References: <20030820092151.H8293-100000@megazone.bigpanda.com>
Stephan Szabo wrote:
> On Wed, 20 Aug 2003, Brian McCane wrote:
>> 4) Can I disable the compression to improve storage speed
>> if the compression algorithm is not as good as deflate
>
> See ALTER TABLE ALTER COLUMN SET STORAGE (I would guess you would want
> external, but I'm not 100% sure, check the docs :) )
Yes, EXTERNAL is correct. We had a good thread on this topic on PERFORM
a couple of weeks ago.
Starts here:
http://archives.postgresql.org/pgsql-performance/2003-08/msg00030.php
Ends here:
http://archives.postgresql.org/pgsql-performance/2003-08/msg00144.php
Note the issue with UPDATE in place of the data. You need to concatenate
an empty string to force the change of storage.
> Also, I'm not sure if storing a compressed version in a text field is a
> good idea. I'd think that bytea would be a better match.
>
You can pretty much guarantee problems if you store binary (i.e.
pre-compressed) data in a text field. If your uncompressed data is not
binary, you should probably do one of these options:
1) pre-compress and store in a bytea field with storage set to EXTERNAL
2) store as-is in a text field and let Postgres do the compression for
you
3) store as-is in a text field with storage set to EXTERNAL
Personally, I'd use #3 if you consider disk space cheap and performance
important, or #2 if you really need the data compressed. You might get
moderately better compression using an external program, but it is
probably at a big performance hit.
HTH,
Joe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: mail@joeconway.com, sszabo@megazone.bigpanda.com, bmccane@mccons.net
Subject: Re: Compression of text fields
In-Reply-To: <3F43ABBB.20405@joeconway.com>
References: <20030820092151.H8293-100000@megazone.bigpanda.com> <3F43ABBB.20405@joeconway.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox