Re: Simple 'type' question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Tim Barnard" <tbarnard(at)povn(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Simple 'type' question
Date: 2002-01-24 23:51:03
Message-ID: 21086.1011916263@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Tim Barnard" <tbarnard(at)povn(dot)com> writes:
> When creating a table with a primary key that can contain any varying
> sequence of alphanumeric characters, is it best to use the 'text' type or
> the 'varchar' type?

If you want a specific upper limit on the string length, use varchar.
If that's not needed, use text. The only difference in performance
AFAIK is the extra function call per insert/update for the routine that
enforces the varchar limit.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-01-24 23:53:12 Re: Is there a drawback when changing NAMEDATALEN to 64?
Previous Message Bruce Momjian 2002-01-24 23:49:30 Re: Is there a drawback when changing NAMEDATALEN to 64?