Re: Postgres advice for Java/Hibernate project - Mailing list pgsql-novice

From Richard Broersma Jr
Subject Re: Postgres advice for Java/Hibernate project
Date
Msg-id 20060619015313.78661.qmail@web31810.mail.mud.yahoo.com
Whole thread Raw
In response to Postgres advice for Java/Hibernate project  ("Damian C" <jamianb@gmail.com>)
List 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.

pgsql-novice by date:

Previous
From: "Damian C"
Date:
Subject: Postgres advice for Java/Hibernate project
Next
From: John DeSoi
Date:
Subject: Re: Postgres advice for Java/Hibernate project