Re: Enum proposal / design

From: Gregory Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tom Dunstan <pgsql(at)tomd(dot)cc>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Enum proposal / design
Date: 2006-08-16 23:21:06
Message-ID: 87veosxo65.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> I think this is excessive concern for bit-shaving. Make the on-disk
> representation be 8 bytes instead of 4, then you can store the OID
> directly and have no need for the separate identifier concept. This
> in turn eliminates one index, one syscache, and one set of lookup/cache
> routines. And you can have as many values of an enum as you darn please.

Egads. bit-shaving is *important*. If it's 8 bytes you could just use a
char(4) and store 4 character text codes instead. The whole reason to want
this feature is precisely for bit-shaving.

I was originally going to reply with some thoughts about how we really ought
to fix things so that we don't need to store the type in every record of the
entire table. That would let you use 1 or 2 bytes for most applications.

Data density is the dominant factor controlling the overall speed of your
database. If you can shave 10% off the width of your records that's a 10%
speed gain in i/o and a 10% gain in headroom.

This is the same issue we have with char(n) and numeric(x,y) already. If we
found a general solution for getting the type name to the enum would it also
help getting the typmod to char(n) and numeric(x,y)? Would it let us store
those as fixed sized data types?

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message ITAGAKI Takahiro 2006-08-17 01:45:00 Adjust autovacuum naptime automatically
Previous Message Gregory Stark 2006-08-16 23:06:22 Re: BugTracker (Was: Re: 8.2 features status)