Re: [GENERAL] ENUM type size

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [GENERAL] ENUM type size
Дата
Msg-id 1038.1504389991@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [GENERAL] ENUM type size  (Олег Самойлов <olleg@mipt.ru>)
Ответы Re: [GENERAL] ENUM type size  (Олег Самойлов <olleg@mipt.ru>)
Список pgsql-general
=?UTF-8?Q?=D0=9E=D0=BB=D0=B5=D0=B3_?= =?UTF-8?Q?=D0=A1=D0=B0=D0=BC=D0=BE=D0=B9=D0=BB=D0=BE=D0=B2?= <olleg@mipt.ru>
writes:
> May I ask the question here or I must go to the pgsql-hackers?
> Why does ENUM type have 4 byte size?

Because it's really an OID under the hood.

> In any use cases, that I know,
> ENUM 255 values (1 byte) more then enough.

Only if you consider each enum type in isolation (and even then, I'd
dispute your argument that nobody has use for more than 255 values).
In our implementation, enum types are essentially all foreign keys into
the same pg_enum catalog, so you definitely need more space.

Other ways of doing it would have created problems of their own.  But
you can certainly build your own enum type if you don't like the tradeoffs
the core code made.

            regards, tom lane


В списке pgsql-general по дате отправления:

Предыдущее
От: Олег Самойлов
Дата:
Сообщение: Re: [GENERAL] Numeric numbers
Следующее
От: Олег Самойлов
Дата:
Сообщение: Re: [GENERAL] ENUM type size