Re: Index does not working.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dan Black <fireworker(at)gmail(dot)com>
Cc: Douglas McNaught <doug(at)mcnaught(dot)org>, PgSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Index does not working.
Date: 2005-06-13 23:41:48
Message-ID: 10221.1118706108@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dan Black <fireworker(at)gmail(dot)com> writes:
> 1)
> select * from my_table where active and deleted
> --------------
> Seq Scan on my_table (cost=100000000.00..100000180.00 rows=2500 width=56)
> Filter: (active AND deleted)

> 2)
> select * from my_table where active = true and deleted = true
> -------------
> Index Scan using my_table_index on my_table (cost=0.00..369.00 rows=2500
> width=56)
> Index Cond: ((deleted = true) AND (active = true))

This is expected: Postgres' internal index API is based around
operators, therefore anything that doesn't look something like
"indexcol operator value" isn't a candidate for an index restriction.

There is a hack in CVS tip that special-cases indexes on boolean
columns so that the above case works, but it's not in any released
version.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-06-13 23:58:34 Re: pg_dumpall not working?
Previous Message Sean Davis 2005-06-13 23:24:52 Re: return next and pl/perl