Enum on-disk format

From: Scott Bailey <artacus(at)comcast(dot)net>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Enum on-disk format
Date: 2009-11-18 23:45:44
Message-ID: 4B048728.4040601@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm trying to better understand the internals of Postgres, and I'm
looking at the enum type. The docs say that an enum value is stored on
disk as 4 bytes. But enum_send() returns a bytea representing the actual
text of the value and not the index of that value. So what step am I
missing here?

Also, is there a way to see the raw data for the tuple on a page? I was
using pageinspect to try to figure out what was happening on the disk.
The get_raw_page function returns the entire page and heap_page_items
will allow me to find the substring that represents a given tuple. But
the rows were much wider than I thought they would be, 28 bytes + 2 byte
spacer to store 4 bytes of data. Is there any way to see which bytes of
an item pointer actually map to columns in a table? And where can I find
more info on how Postgres stores tuples?

Scott Bailey

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-11-18 23:49:11 Re: Enum on-disk format
Previous Message Richard Huxton 2009-11-18 23:28:33 Re: Can anyone help setting up pgbouncer?