From: C. Bensend <benny@bennyvision.com>
To: pgsql-admin@postgresql.org
Subject: Re: VARCHAR -vs- CHAR: huge performance difference?
Date: Tue, 15 Jun 2004 20:31:56 -0500 (CDT)
Message-ID: <55909.63.227.74.41.1087349538.squirrel@webmail.stinkweasel.net> (raw)
In-Reply-To: <1087348985.1582.18.camel@localhost.localdomain>
References: <51429.63.227.74.41.1087347504.squirrel@webmail.stinkweasel.net>
<1087348985.1582.18.camel@localhost.localdomain>
> Were those fields populated just like the varchar fields? If not, then
> the test proves little. If so, I find it hard to believe that char(x)
> would be any faster than varchar. They're all handled about the same.
Hi Scott,
Yes, the new table was populated from the data from the original, via
a:
INSERT INTO emails2 SELECT * FROM emails;
This should be correct, yes?
> If you want to do count(*) on the table, do it by having a table with
> nothing but IDs in it that is referenced by the table with all the
> text. PostgreSQL can't really optimized aggregate functions with
> indexes, so it always winds up doing seq scans.
I have also tried doing a count(column) on the emails table, using a
column that is indexed. It showed no improvement - I would have
expected at least a little gain. And here's the clincher - when I do
a count(*) on a different table with the same number of rows but only
four varchar columns, it returns the result in 75ms. (!!!)
Benny
--
"Oh, the Jedis are going to feel this one!" -- Professor Farnsworth,
"Futurama"
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: benny@bennyvision.com
Subject: Re: VARCHAR -vs- CHAR: huge performance difference?
In-Reply-To: <55909.63.227.74.41.1087349538.squirrel@webmail.stinkweasel.net>
References: <51429.63.227.74.41.1087347504.squirrel@webmail.stinkweasel.net> <1087348985.1582.18.camel@localhost.localdomain> <55909.63.227.74.41.1087349538.squirrel@webmail.stinkweasel.net>
* 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