Re: [GENERAL] Can't I create indexes on BOOL columns?

From: ^chewie <chewie(at)wookimus(dot)net>
To: Manuel Lemos <mlemos(at)acm(dot)org>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Can't I create indexes on BOOL columns?
Date: 1999-12-13 20:25:15
Message-ID: Pine.LNX.4.10.9912131216180.1964-100000@geeks.linux.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 13 Dec 1999, Manuel Lemos wrote:

> Hello,
>
> I am using PostgreSQL 6.4.2. and it seems I can't create indexes on
> BOOL columns. I tried this:
>
> ...snip...
>
> However, if I change the BOOL type to CHAR (1) it works.

I'm not a developer, so I don't know if it's a bug or a logic error
you're pointing out, or even if it's an error at all. However, I could
rationalize that it is not an error on the premise that BOOLEAN
identifiers can only have two values: true or false.

Obviously, you cannot use a UNIQUE index on such an column. A Clustered
index would not do much better, logically, since you're only splitting
up the data into two groups. Therefore, what is the point of indexing
on boolean columns, really? I suppose it would depend upon the data in
the table. If you see one value predominantly over the other, splitting
out the smaller group via the index *may* help your search. However, if
the values are fairly even in proportion, you won't gain much.

I'd say stick with your work-around, and post the question to the devel
team.

----------------------------------------------------------------
Chad Walstrom mailto:chewie(at)wookimus(dot)net
a.k.a ^chewie, gunnarr http://wookimus.net/~chewie

Gnupg = B4AB D627 9CBD 687E 7A31 1950 0CC7 0B18 206C 5AFD
----------------------------------------------------------------

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Charles Martin 1999-12-13 21:11:01 grinding to a halt?
Previous Message Ed Loehr 1999-12-13 20:04:54 Re: [GENERAL] Is it safe to INSERT/DELETE during VACUUM?