Re: Postgres advice for Java/Hibernate project

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Damian C <jamianb(at)gmail(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org List" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Postgres advice for Java/Hibernate project
Date: 2006-06-19 02:05:17
Message-ID: EE7C30AD-7832-4B3B-897D-294ACCD3D4AC@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Assuming Hibernate creates varchar columns (rather than fixed length,
space padded char columns) there is no difference in storage or
performance. This page explains all of the details:

http://www.postgresql.org/docs/8.1/interactive/datatype-character.html

On Jun 18, 2006, at 9:30 PM, Damian C wrote:

> 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??
>
> The issue here is a trade-off in how tightly we need to specify field
> lengths that we are currently unsure of. Are we wasting space if we
> make them large?
>
> 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)?".

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2006-06-19 02:23:24 Re: Postgres advice for Java/Hibernate project
Previous Message Richard Broersma Jr 2006-06-19 01:53:13 Re: Postgres advice for Java/Hibernate project