Dan Black <[EMAIL PROTECTED]> writes:
> 1)
> select * from my_table where active and deleted
> --
> Seq Scan on my_table (cost=1.00..10180.00 rows=2500 width=56)
> Filter: (active AND deleted)
> 2)
> select * from my_table where active = true and deleted = true
> --
Dan Black <[EMAIL PROTECTED]> writes:
> 1)
> select * from my_table where active and deleted
> --
> Seq Scan on my_table (cost=1.00..10180.00 rows=2500 width=56)
> Filter: (active AND deleted)
>
> 2)
> select * from my_table where active = true and deleted = true
> -
1)
select * from my_table where active and deleted
--
Seq Scan on my_table (cost=1.00..10180.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 (c
Dan Black <[EMAIL PROTECTED]> writes:
> First query does not use index in contrast to two query.
>
> Why?
You don't give enough information. Post EXPLAIN ANALYZE output for
both queries and perhaps someone can help.
-Doug
---(end of broadcast)---
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 identi