pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedVARCHAR(50), CHAR(50) or TEXT ?
8+ messages / 7 participants
[nested] [flat]
* VARCHAR(50), CHAR(50) or TEXT ?
@ 1999-05-13 09:08 Henrik Steffen <webmaster@city-map.de>
0 siblings, 0 replies; 8+ messages in thread
From: Henrik Steffen @ 1999-05-13 09:08 UTC (permalink / raw)
To: pgsql-sql
Hello all,
in my database I have a field that will contain never more than 50
characters.
What is the type of choice?
TEXT, CHAR(50) or VARCHAR(50)
I neither want to waste diskspace, nor to slow down data processing.
Thanks,
Henrik
http://www.Stade.net/
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ?
@ 1999-05-13 11:14 Henrik Steffen <webmaster@city-map.de>
1999-05-13 11:49 ` Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Brett W. McCoy <bmccoy@lan2wan.com>
1999-05-13 14:11 ` Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 8+ messages in thread
From: Henrik Steffen @ 1999-05-13 11:14 UTC (permalink / raw)
To: Mark Jewiss <mark@office.knowledge.com>; pgsql-sql
Hello Mark,
Thanks for you quick response.
I understand the difference between CHAR and VARCHAR now.
But, what is the difference between VARCHAR and TEXT ?
Kind regards
Henrik Steffen
http://www.TopConcepts.de/
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ?
1999-05-13 11:14 Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Henrik Steffen <webmaster@city-map.de>
@ 1999-05-13 11:49 ` Brett W. McCoy <bmccoy@lan2wan.com>
1 sibling, 0 replies; 8+ messages in thread
From: Brett W. McCoy @ 1999-05-13 11:49 UTC (permalink / raw)
To: henrik@steffen.stade.net; +Cc: Mark Jewiss <mark@office.knowledge.com>; pgsql-sql
On Thu, 13 May 1999, Henrik Steffen wrote:
> Thanks for you quick response.
>
> I understand the difference between CHAR and VARCHAR now.
>
> But, what is the difference between VARCHAR and TEXT ?
Text fields have no explicit upper limit. They are kinda like memo
fields in Access, except you *can* index them in PostgreSQL.
Brett W. McCoy
http://www.lan2wan.com/~bmccoy/
-----------------------------------------------------------------------
Never get into fights with ugly people because they have nothing to lose.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ?
1999-05-13 11:14 Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Henrik Steffen <webmaster@city-map.de>
@ 1999-05-13 14:11 ` Tom Lane <tgl@sss.pgh.pa.us>
1999-05-13 16:07 ` Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Bruce Momjian <maillist@candle.pha.pa.us>
1 sibling, 1 reply; 8+ messages in thread
From: Tom Lane @ 1999-05-13 14:11 UTC (permalink / raw)
To: henrik@steffen.stade.net; +Cc: pgsql-sql
Henrik Steffen <webmaster@city-map.de> writes:
> But, what is the difference between VARCHAR and TEXT ?
Almost none. VARCHAR won't let you go beyond the stated maximum length,
whereas TEXT has no specific upper limit. Otherwise they are stored
in exactly the same way. (At least in Postgres ... dunno about other
DBMSs.)
I'd be inclined to use TEXT unless the maximum length were really an
important part of the semantics of the data for my application. If
you find yourself saying "Well, I *think* it'll never go beyond N
characters, but maybe I should add a little slop for safety" then
I'd say forget all about VARCHAR and use TEXT. If you find yourself
saying "it *had better not* go beyond N characters, because that
app over there will crash if it does" then use VARCHAR to enforce the
limit.
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ?
1999-05-13 11:14 Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Henrik Steffen <webmaster@city-map.de>
1999-05-13 14:11 ` Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Tom Lane <tgl@sss.pgh.pa.us>
@ 1999-05-13 16:07 ` Bruce Momjian <maillist@candle.pha.pa.us>
1999-05-27 07:00 ` Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Doo Suk Yang <microbe@mail.lgchem.co.kr>
0 siblings, 1 reply; 8+ messages in thread
From: Bruce Momjian @ 1999-05-13 16:07 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: henrik@steffen.stade.net; pgsql-sql
> Henrik Steffen <webmaster@city-map.de> writes:
> > But, what is the difference between VARCHAR and TEXT ?
>
> Almost none. VARCHAR won't let you go beyond the stated maximum length,
> whereas TEXT has no specific upper limit. Otherwise they are stored
> in exactly the same way. (At least in Postgres ... dunno about other
> DBMSs.)
>
> I'd be inclined to use TEXT unless the maximum length were really an
> important part of the semantics of the data for my application. If
> you find yourself saying "Well, I *think* it'll never go beyond N
> characters, but maybe I should add a little slop for safety" then
> I'd say forget all about VARCHAR and use TEXT. If you find yourself
> saying "it *had better not* go beyond N characters, because that
> app over there will crash if it does" then use VARCHAR to enforce the
> limit.
Don't forget, char() has a performance benefit over varchar()/text.
varchar() allows you to document/clip a field to a specific lenght.
Some people like that for fixed-type fields, like "A" for active, "R"
for retired. char(1) documents it is only on character too. See the
FAQ for info on this.
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ?
1999-05-13 11:14 Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Henrik Steffen <webmaster@city-map.de>
1999-05-13 14:11 ` Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Tom Lane <tgl@sss.pgh.pa.us>
1999-05-13 16:07 ` Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Bruce Momjian <maillist@candle.pha.pa.us>
@ 1999-05-27 07:00 ` Doo Suk Yang <microbe@mail.lgchem.co.kr>
1999-05-27 07:10 ` Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Chris Bitmead <chris.bitmead@bigfoot.com>
0 siblings, 1 reply; 8+ messages in thread
From: Doo Suk Yang @ 1999-05-27 07:00 UTC (permalink / raw)
To: pgsql-sql
> > Almost none. VARCHAR won't let you go beyond the stated maximum length,
> > whereas TEXT has no specific upper limit. Otherwise they are stored
~~~~~~~~~~~~~~~~~~~~~~~~~
> > in exactly the same way. (At least in Postgres ... dunno about other
> > DBMSs.)
>
BTW there may be implicit limit. When I tried to insert sequence data an
error occured.
ERROR: Tuple is too big: size 9520
Does that show the limit?
How can I deal with large object?
===============================================================================
Science is the game we play with God to find out what his rules are.
-------------------------------------------------------------------------------
Doo Suk Yang
Research Scientist Voice: 82-42-866-2222
LG Chemical Ltd. Research Park
Biotech Research Institute I FAX: 82-42-861-2566
-------------------------------------------------------------------------------
A fool hath no delight in understanding, but that his heart may discover itself.
(Proverbs 18:2)
===============================================================================
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ?
1999-05-13 11:14 Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Henrik Steffen <webmaster@city-map.de>
1999-05-13 14:11 ` Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Tom Lane <tgl@sss.pgh.pa.us>
1999-05-13 16:07 ` Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Bruce Momjian <maillist@candle.pha.pa.us>
1999-05-27 07:00 ` Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Doo Suk Yang <microbe@mail.lgchem.co.kr>
@ 1999-05-27 07:10 ` Chris Bitmead <chris.bitmead@bigfoot.com>
0 siblings, 0 replies; 8+ messages in thread
From: Chris Bitmead @ 1999-05-27 07:10 UTC (permalink / raw)
To: pgsql-sql
Tuples have an 8k limit.
Doo Suk Yang wrote:
>
> > > Almost none. VARCHAR won't let you go beyond the stated maximum length,
> > > whereas TEXT has no specific upper limit. Otherwise they are stored
> ~~~~~~~~~~~~~~~~~~~~~~~~~
> > > in exactly the same way. (At least in Postgres ... dunno about other
> > > DBMSs.)
> >
>
> BTW there may be implicit limit. When I tried to insert sequence data an
> error occured.
> ERROR: Tuple is too big: size 9520
> Does that show the limit?
>
> How can I deal with large object?
>
> ===============================================================================
> Science is the game we play with God to find out what his rules are.
> -------------------------------------------------------------------------------
> Doo Suk Yang
> Research Scientist Voice: 82-42-866-2222
> LG Chemical Ltd. Research Park
> Biotech Research Institute I FAX: 82-42-861-2566
> -------------------------------------------------------------------------------
> A fool hath no delight in understanding, but that his heart may discover itself.
> (Proverbs 18:2)
> ===============================================================================
^ permalink raw reply [nested|flat] 8+ messages in thread
* RE: [SQL] VARCHAR(50), CHAR(50) or TEXT ?
@ 1999-05-27 15:17 Jackson, DeJuan <djackson@cpsgroup.com>
0 siblings, 0 replies; 8+ messages in thread
From: Jackson, DeJuan @ 1999-05-27 15:17 UTC (permalink / raw)
To: Chris Bitmead <chris.bitmead@bigfoot.com>; pgsql-sql
Use large object to deal with large objects. lo_import, lo_export ...
-DEJ
> Tuples have an 8k limit.
>
> Doo Suk Yang wrote:
> >
> > > > Almost none. VARCHAR won't let you go beyond the stated maximum
> length,
> > > > whereas TEXT has no specific upper limit. Otherwise they are stored
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > in exactly the same way. (At least in Postgres ... dunno about
> other
> > > > DBMSs.)
> > >
> >
> > BTW there may be implicit limit. When I tried to insert sequence data an
> > error occured.
> > ERROR: Tuple is too big: size 9520
> > Does that show the limit?
> >
> > How can I deal with large object?
> >
> >
> ==========================================================================
> =====
> > Science is the game we play with God to find out what his rules are.
> >
> --------------------------------------------------------------------------
> -----
> > Doo Suk Yang
> > Research Scientist Voice: 82-42-866-2222
> > LG Chemical Ltd. Research Park
> > Biotech Research Institute I FAX: 82-42-861-2566
> >
> --------------------------------------------------------------------------
> -----
> > A fool hath no delight in understanding, but that his heart may discover
> itself.
> > (Proverbs 18:2)
> >
> ==========================================================================
> =====
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~1999-05-27 15:17 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-05-13 09:08 VARCHAR(50), CHAR(50) or TEXT ? Henrik Steffen <webmaster@city-map.de>
1999-05-13 11:14 Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Henrik Steffen <webmaster@city-map.de>
1999-05-13 11:49 ` Brett W. McCoy <bmccoy@lan2wan.com>
1999-05-13 14:11 ` Tom Lane <tgl@sss.pgh.pa.us>
1999-05-13 16:07 ` Bruce Momjian <maillist@candle.pha.pa.us>
1999-05-27 07:00 ` Doo Suk Yang <microbe@mail.lgchem.co.kr>
1999-05-27 07:10 ` Chris Bitmead <chris.bitmead@bigfoot.com>
1999-05-27 15:17 RE: [SQL] VARCHAR(50), CHAR(50) or TEXT ? Jackson, DeJuan <djackson@cpsgroup.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox