473,385 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

estimating table size

Given a table, foo, created in a database but not populated, is there a
procedure that will return an estimate of the size of a given tuple in
that table? It looks like pgstattuple reports on actual table pages; I'm
looking for something that reads the lengths of each row, and knows what
the storage overhead would be (extra 4 bytes for varchar, for instance).

Alternatively, is there documentation somewhere that can give me a good
rule of thumb for this? I can add up the lengths of the columns and make
my own judgements about averages for varchar columns. The "hidden"
storage overhead is what I'm wondering about, I guess.

Thanks.

- DAP
================================================== ====
David Parker Tazz Networks (401) 709-5130

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #1
3 2854
On Mon, 26 Jul 2004 18:14:06 -0400, David Parker
<dp*****@tazznetworks.com> wrote:
Given a table, foo, created in a database but not populated, is there a
procedure that will return an estimate of the size of a given tuple in
that table? It looks like pgstattuple reports on actual table pages; I'm
looking for something that reads the lengths of each row, and knows what
the storage overhead would be (extra 4 bytes for varchar, for instance).

Alternatively, is there documentation somewhere that can give me a good
rule of thumb for this? I can add up the lengths of the columns and make
my own judgements about averages for varchar columns. The "hidden"
storage overhead is what I'm wondering about, I guess.


There is a little info in the FAQ:
http://www.postgresql.org/docs/faqs/FAQ.html

particularly sections 4.6 and 4.14

Ian Barwick
ba*****@gmail.com

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #2
Ian Barwick <ba*****@gmail.com> writes:
There is a little info in the FAQ:
http://www.postgresql.org/docs/faqs/FAQ.html
particularly sections 4.6 and 4.14


I think the calculation in section 4.6 is out of date --- it's been
awhile since row headers were 36 bytes. The more correct number is
between 24 and 32 bytes depending on whether you created the table
WITH OIDS and whether your machine requires 4- or 8-byte alignment.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #3

I just updated the FAQ to suggest 32 as the header size (I am assuming
OID's and 4-byte alignment). I am also assuming 7.5 which will loose
the cmin/cmax compression.

---------------------------------------------------------------------------

Tom Lane wrote:
Ian Barwick <ba*****@gmail.com> writes:
There is a little info in the FAQ:
http://www.postgresql.org/docs/faqs/FAQ.html
particularly sections 4.6 and 4.14


I think the calculation in section 4.6 is out of date --- it's been
awhile since row headers were 36 bytes. The more correct number is
between 24 and 32 bytes depending on whether you created the table
WITH OIDS and whether your machine requires 4- or 8-byte alignment.

regards, tom lane


--
Bruce Momjian | http://candle.pha.pa.us
pg***@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ws_dev2001 | last post by:
Hello all, I am trying to obtain the size of a java object in C by using JNI. As we do not have a proper implementation of this in java, I decided to see if C could provide me some accurate data....
2
by: TZone | last post by:
I was hoping I can get some help regarding subject mater located at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/createdb/cm_8_des_02_92k3.asp MyTable has 23 fields with...
2
by: sympatico | last post by:
I am looking for a good document of spread sheet that can help me better estimate the amount of time and money a software development project should take. I am using .NET Framework I have been...
3
by: Stewart Graefner | last post by:
I Started working on a db I'm building as a hobbie, However it has turned into quite a project. I have copyrighted it just incase. Now I'm wondering How do I assess its value if I wanted to sell...
7
by: Roy Smith | last post by:
I've got a large text processing task to attack (it's actually a genomics task; matching DNA probes against bacterial genomes). I've got roughly 200,000 probes, each of which is a 25 character...
0
by: acbcompute | last post by:
This book was just released in ebook and is due in hardcopy in a couple weeks... http://www.porterlearning.com/publications.html "Estimation with Use Cases: A Simple and Effective Approach...
1
momotaro
by: momotaro | last post by:
The mathematician Gottfried Leibniz determined the following formula for estimating the value of Pi (3.1415…): Pi/4 = 1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + …. Evaluate the first 200 terms of this...
2
by: ibmdb2user | last post by:
Hi all, The table in question has 4 fields: UNID 19 chars DATA 2147483647 (BLOB) ROW 19 chars DT 10 chars Second column can take upto 2GB (attachments etc). So I am trying to figure out the...
1
by: Harshaw | last post by:
I am an estimator for an industrial and commercial insulation contractor. I have compiled an enormous amount of data over the years but I am still figuring all of my estimates by hand. For instance,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.