ENUM type size

From: Олег Самойлов <olleg(at)mipt(dot)ru>
To: pgsql-general(at)postgresql(dot)org
Subject: ENUM type size
Date: 2017-09-02 20:23:07
Message-ID: 1504383787.16950.8.camel@mipt.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

May I ask the question here or I must go to the pgsql-hackers?

Why does ENUM type have 4 byte size? In any use cases, that I know,
ENUM 255 values (1 byte) more then enough. And it's only reason for
ENUM, if you need more values then 255 you can create a foreign table
with smallint (or bigger) primary key. And, obviously that table will
be filled by operators or routines, not by a programmer. The only
reason for ENUM is to use for fields with very small set of values, for
instance: sex, day of week, month, etc. And 1 byte size is 4 times
shorter then 4 bytes, especially for big tables.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Олег Самойлов 2017-09-02 21:25:05 Re: Numeric numbers
Previous Message Tom Lane 2017-09-02 20:20:25 Re: Numeric numbers