Re: Problem with estimating pages for a table

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Cristina M <cristina(dot)maier(at)yahoo(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Problem with estimating pages for a table
Date: 2009-05-13 22:56:07
Message-ID: 20090513225607.GH5986@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Cristina M wrote:

> I posted to the general list, and didn't receive any replies.
> Therefore, I am trying this list now, hopefully this is the right
> mailing list for this type of questions.
>
> I am trying to compute the no of pages of a table. I am using the formula :
>
> pages = ( columns width + 28) * no. of rows / block size

Keep in mind that if you have varchar(1000) and store 30 bytes of text,
it will use 30+4, not 1000+4.

Very long attributes may be compressed and/or stored in a side table
called the TOAST table; only a pointer to it remains on the base table
(which is some 20 bytes long I think).

Also keep in mind that there's a lot of space lost to alignment
considerations, so don't expect things to match down to the last byte.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-05-14 01:01:46 Re: Problem with estimating pages for a table
Previous Message Euler Taveira de Oliveira 2009-05-13 21:45:38 Re: Problem with estimating pages for a table