Index does not working.

From: Dan Black <fireworker(at)gmail(dot)com>
To: PgSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: Index does not working.
Date: 2005-06-13 17:55:59
Message-ID: 27f606250506131055364e8075@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I created a table

CREATE TABLE my_table
(
id int4 NOT NULL,
name varchar(64) NOT NULL,
deleted bool NOT NULL,
active bool NOT NULL,
CONSTRAINT my_table_pkey PRIMARY KEY (id)
)

and index

CREATE INDEX my_table_index
ON my_table
USING btree
(deleted, active);

there is two identical queries...

1) select * from my_table where active and deleted

and

2) select * from my_table where active = true and deleted = true

First query does not use index in contrast to two query.

Why?

Thanks.
--
Verba volent, scripta manent
My ISP - http://www.netbynet.ru

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jonah H. Harris 2005-06-13 18:31:17 Re: [HACKERS] mirroring oracle database in pgsql
Previous Message Hugo 2005-06-13 16:52:12 psql newby question, help to port Sybase ASA StoredProcedure