how big is Text in Postgres?

I set up a table schema using hiberante.

the config is

            <property name="bio"  not-null="true" type="text" length="2000" >
                  <column name="BIO" default="''" />
            </property>

when I look at the table schema using a sql client, the field type is indeed "Text", but no indication of size.

How do find out what size was really allocated?
bhomassAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Reza RadConsultant, TrainerCommented:
TEXT is for strings of "unlimited" length (though all fields in PostgreSQL are subject to a maximum value length of one gigabyte).

reference:
http://wiki.postgresql.org/wiki/FAQ

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bhomassAuthor Commented:
is there an alternative to set the max length at 2000, let's say?
0
cminearCommented:
If you want a character field to be limited in size in PostgreSQL, use "character varying(<size>)" or "varchar(<size>)", where you set <size> to the desired length limit.

Using 'psql', this command would change the column definition to use the 'varchar(2000)' type.

  ALTER TABLE your_table ALTER COLUMN bio TYPE varchar(2000);

This will only work if all records have 2000 characters or less in the 'bio' field.

With Hibernate, it would appear that you'd want the type to be "string" instead of "text".
0
bhomassAuthor Commented:
thanks for the advice. I am going to reward the points, but could someone give me some guidance whether I suffer performance and efficiency setback by staying with Text type?

it seems since Text has no max, it must be allocating space as the data grows. in that sense, it is not very different from varchar.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.