On Mon, Nov 5, 2012 at 2:46 PM, Moshe Jacobson <mo...@neadwerx.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


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to