Re: How does TOAST compare to other databases' mechanisms? - Mailing list pgsql-general

From Tom Lane
Subject Re: How does TOAST compare to other databases' mechanisms?
Date
Msg-id 25177.971100763@sss.pgh.pa.us
Whole thread Raw
In response to Re: How does TOAST compare to other databases' mechanisms?  (Philip Warner <pjw@rhyme.com.au>)
Responses Re: How does TOAST compare to other databases' mechanisms?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: How does TOAST compare to other databases' mechanisms?  (Philip Warner <pjw@rhyme.com.au>)
List pgsql-general
Philip Warner <pjw@rhyme.com.au> writes:
> In the case of images, is there a way to tell TOAST not to bother even
> trying to compress the data? (eg. JPEG files). If so, would I be right in
> assuming that this would be better for fast retrieval (even for text
> files)?

TOAST will not store a compressed value unless the compressed value is
smaller than the uncompressed by some reasonable amount (which looks to
be 20% by default).  I'd expect JPEG-like data always to fail the
compression ratio check.  So there's no significant CPU cost at read
time, but there's some cost at write time to try to do the compression.

There is a provision to discourage the toaster from even trying to
compress a particular column --- see the attstorage column in
pg_attribute.  At the moment there's no user interface for that :-(
so you'd have to reach in with a manual "UPDATE pg_attribute" to
change it from the default value.  Someone should work on adding an
ALTER command to change it in a more user-friendly fashion.

            regards, tom lane

pgsql-general by date:

Previous
From: "John Menke"
Date:
Subject: Win98
Next
From: "Adam Lang"
Date:
Subject: Re: image storing