Re: Quickly calculating row size of a table? - Mailing list pgsql-general

From Jim C. Nasby
Subject Re: Quickly calculating row size of a table?
Date
Msg-id 20051021224135.GY16682@pervasive.com
Whole thread Raw
In response to Quickly calculating row size of a table?  ("Jared Evans" <jnevans@gmail.com>)
Responses Re: Quickly calculating row size of a table?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Mon, Oct 17, 2005 at 04:42:15PM -0700, Jared Evans wrote:
> Is there a way for me to quickly calculate the maximum size of a row
> for a table?  I wanted to know if there was an automatic way to do it
> before I do it manually.

Well, if the table is well-vacuumed, SELECT relpages*8192/reltuples from
pg_class will give you a good idea (assuming a default 8K page size),
but of course it's not perfect.

The only way I know of to get row length info for certain is vacuum full
verbose:

decibel=# vacuum full verbose rrs;
INFO:  vacuuming "rrs.rrs"
INFO:  "rrs": found 0 removable, 7 nonremovable row versions in 1 pages
DETAIL:  0 dead row versions cannot be removed yet.
Nonremovable row versions range from 61 to 73 bytes long.
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

pgsql-general by date:

Previous
From: CSN
Date:
Subject: How much slower are numerics?
Next
From: Redefined Horizons
Date:
Subject: Newbie Questions