Optimization FAQ ?

Started by Hiroshi Inoueover 26 years ago1 messages
#1Hiroshi Inoue
Inoue@tpf.co.jp

Hello all,

I got the following result.
It's FAQ ?

drop table int2t;
create table int2t (id int2 primary key);

explain select * from int2t where id=1;
NOTICE: QUERY PLAN:

Seq Scan on int2t (cost=43.00 rows=2 width=2)

explain select * from int2t where id=1::int2;
NOTICE: QUERY PLAN:

Index Scan using int2t_pkey on int2t (cost=2.05 rows=2 width=2)

explain select * from int2t where id='1';
NOTICE: QUERY PLAN:

Index Scan using int2t_pkey on int2t (cost=2.05 rows=2 width=2)

Right behavior ?

Regards.

Hiroshi Inoue
Inoue@tpf.co.jp