Index of /~harley/sw/postgres

      Name                    Last modified       Size  Description

[DIR] Parent Directory 25-Aug-2008 22:28 - [   ] AffxPgNibfile.tar.gz 08-Sep-2003 15:57 8k [   ] ztext-0.1.tar.gz 08-May-2005 17:46 30k

#
# /disk/amelie1/src/db/postgresql-8.0.2/contrib/ztext/README.ztext ---
#
# $Id: README.ztext,v 1.7 2005/05/09 00:40:04 harley Exp $
#
# Author:  harley <harley@panix.com>
#

   "Ztext" provides data compression within postgres.  When
data is converted to "ztext" it is compressed.  It can be
uncompressed with "ztext_uncompress".

   Currently the "ztext_out" function returns a short string
describing the compressed data.  This could be changed to
actually provide the data.  I chose to make uncompression an
explicit user step.  This prevents psql from dumping large
blocks of text.

NOTE: postgres has pg_lzcompress for toasted datatypes.
      "ztext" allows the user to use zlib for compression
      and to suppress the auto-decompression of the data.

INSTALL
------------------------------

cd postgres/contrib
untar ztext.tar.gz
cd ztext
make install


INTERNALS 
------------------------------

   The base structure of the ztype is "bytea".  After the
postgres internal header of VARHDRSIZE, (which is the same
as bytea), is the ztext header of (ALG and T_LEN) which is
followed by the compressed data.

|-- VARHDRSIZE --|-- ALG(1B) --|-- T_LEN(4B) --|-- Z_DATA(0 or more) .... --|

VARHDRSIZE = Same as bytea
ALG        = The compression alg
   00 = none
   01 = gzip
   02 = bzip2
T_LEN       = uncompressed length
Z_DATA      = compressed data




TODO
--------------------

* add "bz2" compression.  A codepoint was left for it.
* Do compression in 32KB blocks to allow 'substring' to decompress
  only the blocks which are needed.
* Dont fetch all the toasted data, just what we need to do our work.