Crystal <support@conceptpatterns.com> writes:
> 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.
Use varchar. Or text, if you don't have a specific upper limit in mind.
> 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.
Once upon a time, in the days of 80-column punch cards and no
variable-length character encodings, there were databases that could
handle fixed-width character fields a bit faster than variable-width.
That doesn't apply to Postgres. There is no, none, nada performance
advantage to char(n), and you should never use it unless your
application data clearly demands a specific field width.
regards, tom lane