Size of tuples

Started by Alex Turnerover 19 years ago4 messagesgeneral
Jump to latest
#1Alex Turner
armtuk@gmail.com

I have a table whose definition is basically

create table foo (
a int,
b int,
c int,
d date
);

and when fully populated, select relpages*8192::long/reltuples from pg_class
where relname='foo';
gives around 52. Why is it so wide when there are only 4*4=16 bytes of
actual data?
The table was populated in one big go, and there have been 0 deletes or
updates, althought I did do a few truncates, but I thought that basically
zeroed everything?

Alex.

#2Ron Johnson
ron.l.johnson@cox.net
In reply to: Alex Turner (#1)
Re: Size of tuples

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/09/06 19:10, Alex Turner wrote:

I have a table whose definition is basically

create table foo (
a int,
b int,
c int,
d date
);

and when fully populated, select relpages*8192::long/reltuples from
pg_class
where relname='foo';
gives around 52. Why is it so wide when there are only 4*4=16 bytes of
actual data?

http://www.postgresql.org/docs/faqs.FAQ.html#item4.5

   23  row header (no OIDs)
 + 16  your row size
 +  4  page pointer
   --
   43

I'd guess that the extra 4 bytes is from the null bits, page
overhead, etc.

- --
Ron Johnson, Jr.
Jefferson LA USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFKvWNS9HxQb37XmcRAuadAKDTDW3nSap3VutXXZB1vHnAFXMd8QCeIqpc
vMEiTn+MTBeP6wEkLO3zdwI=
=VeUp
-----END PGP SIGNATURE-----

#3Alex Turner
armtuk@gmail.com
In reply to: Ron Johnson (#2)
Re: Size of tuples

Awesome - thank you!

Alex

Show quoted text

On 10/9/06, Ron Johnson <ron.l.johnson@cox.net> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/09/06 19:10, Alex Turner wrote:

I have a table whose definition is basically

create table foo (
a int,
b int,
c int,
d date
);

and when fully populated, select relpages*8192::long/reltuples from
pg_class
where relname='foo';
gives around 52. Why is it so wide when there are only 4*4=16 bytes of
actual data?

http://www.postgresql.org/docs/faqs.FAQ.html#item4.5

23  row header (no OIDs)
+ 16  your row size
+  4  page pointer
--
43

I'd guess that the extra 4 bytes is from the null bits, page
overhead, etc.

- --
Ron Johnson, Jr.
Jefferson LA USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFKvWNS9HxQb37XmcRAuadAKDTDW3nSap3VutXXZB1vHnAFXMd8QCeIqpc
vMEiTn+MTBeP6wEkLO3zdwI=
=VeUp
-----END PGP SIGNATURE-----

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

http://archives.postgresql.org

#4Ron Johnson
ron.l.johnson@cox.net
In reply to: Alex Turner (#3)
Re: Size of tuples

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You know, I'd have sworn that I changed "extra 4" to "extra 9"

Sorry.

On 10/10/06 12:49, Alex Turner wrote:

Awesome - thank you!

Alex

On 10/9/06, *Ron Johnson* <ron.l.johnson@cox.net
<mailto:ron.l.johnson@cox.net>> wrote:

On 10/09/06 19:10, Alex Turner wrote:

I have a table whose definition is basically

create table foo (
a int,
b int,
c int,
d date
);

and when fully populated, select relpages*8192::long/reltuples from
pg_class
where relname='foo';
gives around 52. Why is it so wide when there are only 4*4=16

bytes of

actual data?

http://www.postgresql.org/docs/faqs.FAQ.html#item4.5

23  row header (no OIDs)
+ 16  your row size
+  4  page pointer
--
43

I'd guess that the extra 4 bytes is from the null bits, page
overhead, etc.

- --
Ron Johnson, Jr.
Jefferson LA USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFLAysS9HxQb37XmcRAuFYAJ9tQ6sQIJ/WSX+L7JUkxYwRFypdBACdFmuT
YwZV6SW2TBLp4UqrofQpExk=
=OHjG
-----END PGP SIGNATURE-----