Re: Varchar vs foreign key vs enumerator - table and index size

Поиск
Список
Период
Сортировка
От Łukasz Walkowski
Тема Re: Varchar vs foreign key vs enumerator - table and index size
Дата
Msg-id 9F6FD605-91FC-4633-B393-75503463C7E7@homplex.pl
обсуждение исходный текст
Ответ на Re: Varchar vs foreign key vs enumerator - table and index size  (Vitalii Tymchyshyn <tivv00@gmail.com>)
Ответы Re: Varchar vs foreign key vs enumerator - table and index size  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-performance
On 1 wrz 2013, at 05:10, Vitalii Tymchyshyn <tivv00@gmail.com> wrote:
>
>
> Well, there are some more options:
> a) Store int keys and do mapping in the application (e.g. with java enums). This can save you a join, that is
especiallyuseful if you are going to do paged output with limit/offset scenario. Optimizer sometimes produce suboptimal
plansfor join in offset/limit queries. 
> b) Store small varchar values as keys (up to "char" type if you really want to save space) and do user display
mappingin application. It's different from (a) since it's harder to mess with the mapping and values are still more or
lessreadable with simple select. But it can be less efficient than (a). 
> c) Do mixed approach with mapping table, loaded on start into application memory. This would be an optimization in
caseyou get into optimizer troubles. 
>
> Best regards, Vitalii Tymchyshyn

I'd like to leave database in readable form because before I add some new queries and rest endpoints to the
application,I test them as ad-hoc queries using command line. So variant a) isn't good for me. Variant b) is worth
tryingand c) is easy to code, but I still prefer having all this data in database independent of application logic. 

Thanks for suggestion,
Lukasz

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

Предыдущее
От: Łukasz Walkowski
Дата:
Сообщение: Re: Varchar vs foreign key vs enumerator - table and index size
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: Varchar vs foreign key vs enumerator - table and index size