pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeffrey W. Baker <jwbaker@acm.org>
To: Ron <rjpeace@earthlink.net>
Cc: pgsql-performance@postgresql.org
Subject: Re: Size and performance hit from using UTF8 vs. ASCII?
Date: Wed, 08 Feb 2006 07:54:01 -0800
Message-ID: <1139414042.8707.7.camel@localhost.localdomain> (raw)
In-Reply-To: <7.0.1.0.2.20060208090456.035842d0@earthlink.net>
References: <7.0.1.0.2.20060208090456.035842d0@earthlink.net>

On Wed, 2006-02-08 at 09:11 -0500, Ron wrote:
> I'm specifically interested in the default C Locale; but if there's a 
> difference in the answer for other locales, I'd like to hear about 
> that as well.

The size hit will be effectively zero if your data is mainly of the
ASCII variety, since ASCII printable characters to UTF-8 is an identity
transform.  However anything involving string comparisons, including
equality, similarity (LIKE, regular expressions), or any other kind of
comparison (ORDER BY, GROUP BY) will be slower.  In my experience the
performance hit varies from zero to 100% in CPU time.  UTF-8 is never
faster that ASCII, as far as I know.

However, if you need UTF-8 then you need it, and there's no point in
worrying about the performance hit.

You may as well just do two benchmark runs with your database
initialized in either character set to see for yourself.

-jwb





view thread (2+ messages)

Message-ID: <1139414042.8707.7.camel@localhost.localdomain>
Permalink:  ../1139414042.8707.7.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1139414042.8707.7.camel@localhost.localdomain

 · 

reply

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-performance@postgresql.org
  Cc: jwbaker@acm.org, rjpeace@earthlink.net
  Subject: Re: Size and performance hit from using UTF8 vs. ASCII?
  In-Reply-To: <1139414042.8707.7.camel@localhost.localdomain>

* 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