postgeSQL datatype Text question

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
myleow
Forum Contributor
Posts: 194
Joined: Mon Jun 21, 2004 7:05 pm
Location: California

postgeSQL datatype Text question

Post by myleow »

If i have a

column A with type VARCHAR(10);

and

column B with type TEXT;


I then insert "ABCDEFGHIJ", which is a string of length 10. Would it take up more space in DB when inserted into column B compared to column A?

I always have the idea that TEXT datatype takes up more reserve space (before any thing is inserted) in PostgreSQL and thus always went for VARCHAR. Unfortunately most of the time, i cannot control the length of the string that is coming into the database.

Please explain. Even if i am right, please say so because i am confused.

Regards
Mian
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

why not check the size of the database/table with it yourself and find out definitively?
myleow
Forum Contributor
Posts: 194
Joined: Mon Jun 21, 2004 7:05 pm
Location: California

Post by myleow »

HOw do you do that?
myleow
Forum Contributor
Posts: 194
Joined: Mon Jun 21, 2004 7:05 pm
Location: California

Post by myleow »

anyone know how to check the size of the table/database in PostgreSQL please instruct me, please.

Regards
Mian
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Post Reply