From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Mark Kirkwood <markir(at)paradise(dot)net(dot)nz> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: TODO Item - Return compressed length of TOAST datatypes |
Date: | 2005-07-06 19:09:19 |
Message-ID: | 200507061909.j66J9J628254@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Mark Kirkwood wrote:
> I did a few cleanups on the last patch. Please examine this one instead.
> The changes are:
>
> 1. Add documentation for pg_datum_length builtin.
> 2. Correct some typos in the code comments.
> 3. Move the code in toastfuncs.c to varlena.c as it is probably the
> correct place.
> 4. Use ereport instead of elog.
> 5 Quiet compiler warning in pg_datum_length.
I have modified your patch to simplify the logic, and renamed it to
pg_column_size(), to be consistent with our soon-to-be-added
pg_relation/tablespace/database functions from dbsize.
Here is a sample usage:
test=> CREATE TABLE test (x INT, y TEXT);
CREATE TABLE
test=> INSERT INTO test VALUES (4, repeat('x', 10000));
INSERT 0 1
test=> INSERT INTO test VALUES (4, repeat('x', 100000));
INSERT 0 1
test=> SELECT pg_column_size(x), pg_column_size(y) FROM test;
pg_column_size | pg_column_size
----------------+----------------
4 | 121
4 | 1152
(2 rows)
Interesting the 10-times larger column is 10-times larger in storage.
Do we have some limit on how many repeated values we can record?
Patch attached and applied.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 6.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2005-07-06 23:43:02 | Re: Autovacuum integration |
Previous Message | Tom Lane | 2005-07-06 19:07:42 | Re: More to Bad link Makefile patch |