From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matt Mello <alien@spaceship.com>
Cc: pgsql-performance <pgsql-performance@postgresql.org>
Subject: Re: 1 char in the world
Date: Wed, 29 Jan 2003 10:56:27 -0500
Message-ID: <26667.1043855787@sss.pgh.pa.us> (raw)
In-Reply-To: <3E37733D.90205@spaceship.com>
References: <3E37733D.90205@spaceship.com>
Matt Mello <alien@spaceship.com> writes:
> Test query=
> "char"/TEXT: explain analyze select count(*) from table where bool='Y';
> boolean: explain analyze select count(*) from table where bool=true;
> Table size (see above)
> Performance averages:
> TEXT 24ms
> BOOLEAN 28ms
> "char" 17ms
I don't believe those numbers for a moment. All else being equal,
comparing a "char" field to a literal should be exactly the same speed
as comparing a bool field to a literal (and if you'd just said "where bool",
the bool field would be faster). Both ought to be markedly faster than
text.
Look for errors in your test procedure. One thing I'd particularly
wonder about is whether the query plans are the same. In the absence of
any VACUUM ANALYZE data, I'd fully expect the planner to pick a
different plan for a bool field than text/char --- because even without
ANALYZE data, it knows that a bool column has only two possible values.
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 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-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, alien@spaceship.com
Subject: Re: 1 char in the world
In-Reply-To: <26667.1043855787@sss.pgh.pa.us>
References: <3E37733D.90205@spaceship.com> <26667.1043855787@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