Professional Web Applications Themes

question on new psql datatype - PostgreSQL / PGSQL

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. ...

  1. #1

    Default question on new psql datatype

    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.

    Yu






    ---------------------------(end of broadcast)---------------------------
    TIP 1: subscribe and unsubscribe commands go to [email]majordomopostgresql.org[/email]

    Yu Pan Guest

  2. #2

    Default Re: question on new psql datatype

    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 [url]http://developer.postgresql.org/docs/postgres/storage-toast.html[/url]

    Also read the code related to substring in TEXT and BYTEA in
    non-compressed mode.

    HTH,

    --
    Alvaro Herrera (<alvherre[]dcc.uchile.cl>)
    "At least to kernel hackers, who really are human, despite occasional
    rumors to the contrary" (LWN.net)

    ---------------------------(end of broadcast)---------------------------
    TIP 7: don't forget to increase your free space map settings

    Alvaro Herrera Guest

  3. #3

    Default Re: question on new psql datatype

    Hello Yu Pu,

    Am 2005-01-23 16:34:44, schrieb Yu Pan:
    > 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
    Realy cool
    > 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.
    No, thats not right.

    An Image is a Header (image type, width, height, rawsize, colortable)
    plus the Data

    In most cases the Header is between 20 and 300 Bytes
    But which data do you need exactly ?

    I have done this in Winword 6.0 under WfW 3.11 for 10 years :-)
    You need only the first Bytes not the whole Image.
    > Yu
    Greetings
    Michelle

    --
    Linux-User #280138 with the Linux Counter, [url]http://counter.li.org/[/url]
    Michelle Konzack Apt. 917 ICQ #328449886
    50, rue de Soultz MSM LinuxMichi
    0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.5 (GNU/Linux)

    iD8DBQFB9D3aC0FPBMSS+BIRAno5AKC9RzN12NkrMS0LDp4bmA 2T1ckZMgCdHC9a
    wDzrc6pi43djYuv0V3bZ3Q8=
    =6nET
    -----END PGP SIGNATURE-----

    Michelle Konzack Guest

Similar Threads

  1. psql question on echo output
    By John DeSoi in forum PostgreSQL / PGSQL
    Replies: 0
    Last Post: February 3rd, 06:59 AM
  2. speaks psql unicode?
    By John DeSoi in forum PostgreSQL / PGSQL
    Replies: 0
    Last Post: January 15th, 04:43 AM
  3. Running a void function in psql
    By Eric Brown in forum PostgreSQL / PGSQL
    Replies: 1
    Last Post: January 11th, 11:32 PM
  4. Running functions that return void in psql
    By Eric Brown in forum PostgreSQL / PGSQL
    Replies: 4
    Last Post: December 15th, 09:07 AM
  5. Question on Lvarchar Datatype
    By KalpanaPai in forum Informix
    Replies: 1
    Last Post: September 15th, 02:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139