Re: Postgres advice for Java/Hibernate project

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Damian C <jamianb(at)gmail(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Postgres advice for Java/Hibernate project
Date: 2006-06-19 01:53:13
Message-ID: 20060619015313.78661.qmail@web31810.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> 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??

http://www.postgresql.org/docs/8.1/interactive/datatype-character.html
It looks like either is possible depending upon the datatype that you choose for your field.

> 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?

it looks like char will use all of the field length by "padding" your value with additional spaces
to complete the field length.

> 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)?".

I am not to sure here. If no one else respondes, you can always develop a test case around the
type and quanity of data you are using to see if makes a difference.

Regards,

Richard Broersma Jr.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message John DeSoi 2006-06-19 02:05:17 Re: Postgres advice for Java/Hibernate project
Previous Message Damian C 2006-06-19 01:30:19 Postgres advice for Java/Hibernate project