Re: Putting an INDEX on a boolean field?

From: Jaime Casanova <systemguards(at)gmail(dot)com>
To: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Putting an INDEX on a boolean field?
Date: 2005-06-17 05:42:22
Message-ID: c2d9e70e0506162242557a7e65@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 6/17/05, Marc G. Fournier <scrappy(at)postgresql(dot)org> wrote:
> On Fri, 17 Jun 2005, Tom Lane wrote:
>
> > "Marc G. Fournier" <scrappy(at)postgresql(dot)org> writes:
> >> Does that make sense? Would it ever get used?
> >
> > It could get used if one of the two values is far less frequent than the
> > other. Personally I'd think about a partial index instead ...
>
> Hrmmmm, hadn't thought of that ... wouldn't you have to build two indexes
> (one for true, one for false) for this to be completely effective? unless
> you know all your queries are going to search for one, but not the other?
>

I guess it will be effective only if you know wich value will be less
frequent... on the other value a sequential scan will be a win, isn't
it?

--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Fatih Cerit 2005-06-17 10:01:15 substr or char_length problem
Previous Message Marc G. Fournier 2005-06-17 05:04:12 Re: Putting an INDEX on a boolean field?