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