Re: The speed problem of Varchar vs. Char - Mailing list pgsql-general

From Josh Tolley
Subject Re: The speed problem of Varchar vs. Char
Date
Msg-id e7e0a2570707081656s2c0d26fage7fb28998214e6e2@mail.gmail.com
Whole thread Raw
In response to The speed problem of Varchar vs. Char  (Crystal <support@conceptpatterns.com>)
Responses Re: The speed problem of Varchar vs. Char  (Crystal <support@conceptpatterns.com>)
List pgsql-general
On 7/8/07, Crystal <support@conceptpatterns.com> wrote:
> Hi All,
>
> Our company need to save contact details into the PostgreSQL database. I
> just begin to learn it, so I got many questions. I am not sure which
> data type I should choose for website address, varchar or char. The
> website address may be very long, and we also don't want to lose the
> speed. Thus, the question is: if we have a large contact database, how
> much slowdown or speed up will be expected if we choose variable length
> rather than fixed length? Thanks forward.
>
> Best Wishes,
> Crystal
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>                http://archives.postgresql.org/
>

See http://www.postgresql.org/docs/8.2/interactive/datatype-character.html
(or whatever the corresponding page is for the version you're using).
Specifically, the following:

Tip:  There are no performance differences between these three types,
apart from the increased storage size when using the blank-padded
type. While character(n) has performance advantages in some other
database systems, it has no such advantages in PostgreSQL. In most
situations text or character varying should be used instead.

- Josh

pgsql-general by date:

Previous
From: "Martin Gainty"
Date:
Subject: Re: The speed problem of Varchar vs. Char
Next
From: Tom Lane
Date:
Subject: Re: The speed problem of Varchar vs. Char