Re: Quickly calculating row size of a table?

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Jared Evans <jnevans(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Quickly calculating row size of a table?
Date: 2005-10-21 22:41:35
Message-ID: 20051021224135.GY16682@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Redefined Horizons 2005-10-21 22:52:33 Newbie Questions
Previous Message CSN 2005-10-21 22:30:15 How much slower are numerics?