From: | "John Gray" <jgray(at)azuli(dot)co(dot)uk> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: uploading files |
Date: | 2003-11-19 23:05:38 |
Message-ID: | bpgt7u$1fp3$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-general |
On Tue, 18 Nov 2003 21:22:56 +0100, Karsten Hilbert wrote:
>> I think the field will still be competely loaded into memory on the
>> server side though, while LOs are stored in "chunks" and can
>> theoretically be streamed to the client. I'm not really a definitive
>> authority, though...
> Ah ! Sounds about right ! Something new to learn every day :-)
>
Actually, bytea and text are chunked behind the scenes (the technique
known as TOAST). They are also compressed(LZ) by default. However
if you anticipate substringing them a lot (or if they are not very
compressible anyway), use ALTER TABLE xxx ALTER COLUMN yyy SET STORAGE
EXTERNAL to turn off the automatc compression of values. This allows the
substr operation to read the minimum number of chunks necessary of disk.
Bear in mind of course, that the whole value will take up more disk space,
so reading it in its entirety will be slower (IO is normally the limiting
performance factor -CPU on a DB server is often cheap by comparison, so
decompressing/compressing to save IO is a good idea). If however you
always fetch small parts (e.g. you store large images and usually want to
read the header info from them, EXTERNAL is a good bet (and depending on
the image format, the compression might not compress them very much anyway).
Finally, note that the substr optimisation for text only really buys you
anything if the character-set is single-byte.
Hope this helps
John Gray
(implementer of substr optimisation many moons ago!)
From | Date | Subject | |
---|---|---|---|
Next Message | Shridhar Daithankar | 2003-11-20 06:19:55 | Re: Point-in-time data recovery - v.7.4 |
Previous Message | Stephan Szabo | 2003-11-19 20:39:09 | Re: Automatic null values convertion in INSERT and WHERE |
From | Date | Subject | |
---|---|---|---|
Next Message | Josué Maldonado | 2003-11-19 23:20:43 | Re: Tunning postgresql |
Previous Message | Randolf Richardson, DevNet SysOp 29 | 2003-11-19 22:43:02 | Re: Humor me: Postgresql vs. MySql (esp. licensing) |