Lists: | pgsql-general |
---|
From: | "Tim Barnard" <tbarnard(at)povn(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Simple 'type' question |
Date: | 2002-01-24 23:11:36 |
Message-ID: | 018a01c1a52c$790ca360$a519af3f@hartcomm.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
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? Or will the implicit index that's created on the primary
key work equally well with either type? Any suggestions would be much
appreciated.
Tim Barnard
S.E. Mgr
Hartford Communications Corporation
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 |
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
From: | "Tim Barnard" <tbarnard(at)povn(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Simple 'type' question |
Date: | 2002-01-25 00:11:23 |
Message-ID: | 01a601c1a534$d2e9baa0$a519af3f@hartcomm.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Thanks Tom.
Tim Barnard
S.E. Mgr
Hartford Communications Corporation
----- Original Message -----
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>
Sent: Thursday, January 24, 2002 3:51 PM
Subject: Re: [GENERAL] Simple 'type' question
> "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
>