Re: Postgres advice for Java/Hibernate project

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Postgres advice for Java/Hibernate project
Дата
Msg-id 8950.1150683804@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Postgres advice for Java/Hibernate project  ("Damian C" <jamianb@gmail.com>)
Ответы Re: Postgres advice for Java/Hibernate project  ("Damian C" <jamianb@gmail.com>)
Список pgsql-novice
"Damian C" <jamianb@gmail.com> writes:
> Question ONE: If we design a field (say) 50 characters long - and we
> have an instance/row using only (say) 20 characters - does Postgres
> "use" the whole 50, or only the 20??

Do you have a concrete reason to put a limit on the field width at all?
If not, don't.  Use type text, or varchar without any particular length
limit.  In any case, avoid type char(N), which is a historical hangover
that no longer has an excuse to live ...

> Question TWO: When following typical Hibernate examples we notice that
> String fields are typically specified with a length at a "binary
> boundary".  So they seem to always be specified at 16, 32, 64, 128
> etc. Really the question should be "is a String length 17 (or 33 or
> 65) significantly slower to insert/search/retrieve than a String of
> length 16 (or 32 or 64)?".

Perhaps there's some database somewhere that cares, but Postgres
certainly doesn't.  I rather doubt there's a reason for it on the Java
side either.

            regards, tom lane

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

Предыдущее
От: John DeSoi
Дата:
Сообщение: Re: Postgres advice for Java/Hibernate project
Следующее
От: "Damian C"
Дата:
Сообщение: Re: Postgres advice for Java/Hibernate project