From: Tom Lane <tgl@sss.pgh.pa.us>
To: mlennert@club.worldonline.be
Cc: pgsql-sql@postgresql.org
Subject: Re: performance question
Date: Mon, 20 Jan 2003 15:38:20 -0500
Message-ID: <20147.1043095100@sss.pgh.pa.us> (raw)
In-Reply-To: <59665.164.15.128.4.1043062834.squirrel@http://moritz.homelinux.org>
References: <59665.164.15.128.4.1043062834.squirrel@http://moritz.homelinux.org>
"Moritz Lennert" <mlennert@club.worldonline.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, mlennert@club.worldonline.be
Subject: Re: performance question
In-Reply-To: <20147.1043095100@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox