From: | Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> |
---|---|
To: | Yu Pan <yupan(at)nmsu(dot)edu> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: question on new psql datatype |
Date: | 2005-01-24 00:10:05 |
Message-ID: | 20050124001005.GL19315@dcc.uchile.cl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sun, Jan 23, 2005 at 04:34:44PM -0700, Yu Pan wrote:
> I am developing a new "image" datatype in postgres which contains a binary
> field for storing image data and some other fields for additional information
> about the image, like size, resolution, etc. I was hoping that the clients can
> saving their time by directly retrieving these information from the fields
> without retrieving the whole image, that is, the time for reading these fields
> should be constant with respect to the image size. However, the result shows
> that the time for direct retrieving of information from the fields of an image
> datatype is still increasing with the size of the image. My explanation is
> that in order to read the fields of a image datatype, the whole struct would
> still need to be loaded into memory, which includes the binary field
> containing the actual image data. Can anyone tell me is this true for a user-
> defined datatype (using C struct)? Thanks a lot.
I'd think that if the datatype was stored compressed, then yes, the
system needs to load the whole field before being able to access any
member. You could try setting the storage type to EXTERNAL.
See http://developer.postgresql.org/docs/postgres/storage-toast.html
Also read the code related to substring in TEXT and BYTEA in
non-compressed mode.
HTH,
--
Alvaro Herrera (<alvherre[(at)]dcc(dot)uchile(dot)cl>)
"At least to kernel hackers, who really are human, despite occasional
rumors to the contrary" (LWN.net)
From | Date | Subject | |
---|---|---|---|
Next Message | Michelle Konzack | 2005-01-24 00:14:18 | Re: question on new psql datatype |
Previous Message | Yu Pan | 2005-01-23 23:34:44 | question on new psql datatype |