Search Postgresql Archives

Re: How to evaluate disk space needed by a table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* 高健 (luckyjackgao@xxxxxxxxx) wrote:
> So , Is there any  method to correctly evaluate  disk space one table will
> need,
> given the table's column data types and , estimated record numbers ?

The simplest might be to do exactly what you did- create the table and
then check the size with a subset of records.  It won't be exactly
linear from there but it'd provide a good estimate.

Otherwise, you need to consider the various additional fields which
PostgreSQL adds to every tuple to keep track of visibility and other
information.  Then you have to add in the page header and the other bits
of the tuple header beyond the system columns.  Lastly, you need to
figure out how many tuples will actually fit on a page based on their
size, because there will be gaps if the tuple doesn't fit exactly into
the remaining space in the page.

btw, there are helper functions to get disk usage-
pg_total_relation_size() and pg_relation_size() come to mind, though
there are also others.

	Thanks,

		Stephen

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux