From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
Cc: | Brian McCane <bmccane(at)mccons(dot)net>, pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Compression of text fields |
Date: | 2003-08-20 17:11:23 |
Message-ID: | 3F43ABBB.20405@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas LeBlanc | 2003-08-20 19:03:02 | template1 database... |
Previous Message | Stephan Szabo | 2003-08-20 16:26:17 | Re: Compression of text fields |