From: | tgl(at)postgresql(dot)org (Tom Lane) |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: This patch addresses some issues in TOAST compression strategy |
Date: | 2008-03-07 23:20:21 |
Message-ID: | 20080307232021.5D400753F32@cvs.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Log Message:
-----------
This patch addresses some issues in TOAST compression strategy that
were discussed last year, but we felt it was too late in the 8.3 cycle to
change the code immediately. Specifically, the patch:
* Reduces the minimum datum size to be considered for compression from
256 to 32 bytes, as suggested by Greg Stark.
* Increases the required compression rate for compressed storage from
20% to 25%, again per Greg's suggestion.
* Replaces force_input_size (size above which compression is forced)
with a maximum size to be considered for compression. It was agreed
that allowing large inputs to escape the minimum-compression-rate
requirement was not bright, and that indeed we'd rather have a knob
that acted in the other direction. I set this value to 1MB for the
moment, but it could use some performance studies to tune it.
* Adds an early-failure path to the compressor as suggested by Jan:
if it's been unable to find even one compressible substring in the
first 1KB (parameterizable), assume we're looking at incompressible
input and give up. (Possibly this logic can be improved, but I'll
commit it as-is for now.)
* Improves the toasting heuristics so that when we have very large
fields with attstorage 'x' or 'e', we will push those out to toast
storage before considering inline compression of shorter fields.
This also responds to a suggestion of Greg's, though my original
proposal for a solution was a bit off base because it didn't fix
the problem for large 'e' fields.
There was some discussion in the earlier threads of exposing some
of the compression knobs to users, perhaps even on a per-column
basis. I have not done anything about that here. It seems to me
that if we are changing around the parameters, we'd better get some
experience and be sure we are happy with the design before we set
things in stone by providing user-visible knobs.
Modified Files:
--------------
pgsql/src/backend/access/heap:
tuptoaster.c (r1.83 -> r1.84)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/heap/tuptoaster.c?r1=1.83&r2=1.84)
pgsql/src/backend/utils/adt:
pg_lzcompress.c (r1.29 -> r1.30)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/pg_lzcompress.c?r1=1.29&r2=1.30)
pgsql/src/include/utils:
pg_lzcompress.h (r1.16 -> r1.17)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/pg_lzcompress.h?r1=1.16&r2=1.17)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-03-08 00:39:53 | Re: pgsql: Fix memory arrangement of tsquery after removing stop words. |
Previous Message | Tom Lane | 2008-03-07 21:55:17 | Re: Re: [COMMITTERS] pgsql: Add: > o Add SQLSTATE severity to PGconn return status > > |