A space-efficient, user-friendly way to store categorical data

Поиск
Список
Период
Сортировка
От Andrew Kane
Тема A space-efficient, user-friendly way to store categorical data
Дата
Msg-id CACDdp+b0=o_jsoLnmq=5eL3mmpcxxYH1AZoqg-yz9tSP1+rVyA@mail.gmail.com
обсуждение исходный текст
Ответы Re: A space-efficient, user-friendly way to store categorical data
Re: A space-efficient, user-friendly way to store categorical data
Список pgsql-hackers
Hi,

I'm hoping to get feedback on an idea for a new data type to allow for efficient storage of text values while keeping reads and writes user-friendly. Suppose you want to store categorical data like current city for users. There will be a long list of cities, and many users will have the same city. Some options are:

- Use a text column
- Use an enum column - saves space, but labels must be set ahead of time
- Create another table for cities (normalize) - saves space, but complicates reads and writes

A better option could be a new "dynamic enum" type, which would have similar storage requirements as an enum, but instead of labels being declared ahead of time, they would be added as data is inserted.

It'd be great to hear what others think of this (or if I'm missing something). Another direction could be to deduplicate values for TOAST-able data types.

Thanks,
Andrew

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: ldapi support
Следующее
От: Petr Jelinek
Дата:
Сообщение: Re: ALTER TABLE ADD COLUMN fast default