From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | Moshe Jacobson <moshe(at)neadwerx(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Difference between varchar and text? |
Date: | 2012-11-05 21:15:06 |
Message-ID: | CAHyXU0w7FtXRhfuswJDCrV1vX9K9yBgX3aG0Hk0C9x4LRWLXgQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Nov 5, 2012 at 2:46 PM, Moshe Jacobson <moshe(at)neadwerx(dot)com> wrote:
> Is there any practical difference between defining a column as a varchar(n)
> vs. a varchar vs. a text field?
not much. varchar(n) only forces the length to be <= n. I dislike
inventing an 'n' when one is not known, but a lot of people do it.
> I've always been under the impression that if I am wanting to index a
> varchar column, it is better to set a maximum length. Is this correct?
> But more importantly, what's the practical difference between varchar with
> no limit and text?
That is pretty much true. Index entries for a column in a btree are
constrained to a be of a size of slightly less than page size. But
this is true if you set the length or not.
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2012-11-05 21:22:54 | Re: Difference between varchar and text? |
Previous Message | Moshe Jacobson | 2012-11-05 20:46:01 | Difference between varchar and text? |