Re: performance question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mlennert(at)club(dot)worldonline(dot)be
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: performance question
Date: 2003-01-20 20:38:20
Message-ID: 20147.1043095100@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Moritz Lennert" <mlennert(at)club(dot)worldonline(dot)be> writes:
> One question I asked myself is whether the use of char(2) is the best
> option.

It may not be, particularly if you are running in a non-English locale.
Comparisons will invoke the standard library routine strcoll(), which is
depressingly slow in some locales, at least on some platforms.

> The column (and most others in the table) contains codes that
> designate different characteristics (for ex. in a column 'sex' one would
> find '1'=male, '2'=female).

If you are using numeric codes you are surely better off storing them
as integer or perhaps smallint (integer is less likely to create type
mismatch headaches, though). In the above example you are getting the
worst of both worlds: there's no mnemonic value in your data entries,
*and* you're paying for textual comparisons.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tomasz Myrta 2003-01-20 21:05:47 Re: performance question
Previous Message Moritz Lennert 2003-01-20 19:34:18 Re: performance question