From: | "Magnus Naeslund\(f\)" <mag(at)fbab(dot)net> |
---|---|
To: | <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Not scanning by index |
Date: | 2001-05-03 19:15:43 |
Message-ID: | 010301c0d405$7329fb30$020a0a0a@totalmef |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I have a table:
create table forsamling (
id SERIAL,
for_id int4 unique not null,
kund_flag int8 not null default 1,
online smallint default 0,
klar smallint default 0,
);
create index forsamling_idx on forsamling(for_id,online,klar,kund_flag);
It has about 1000 entries in this table...
Why doesn't it go by indexes when i search the smallints and int8s, but it
works with the integer SERIAL (SERIAL creates it's own index)?
What can i do to make it go by index?
/Magnus
explain select * from forsamling where klar = 1;
NOTICE: QUERY PLAN:
Seq Scan on forsamling (cost=0.00..23.50 rows=1 width=88)
-----
explain select * from forsamling where kund_flag = 123;
NOTICE: QUERY PLAN:
Seq Scan on forsamling (cost=0.00..23.50 rows=1 width=88)
-----
explain select * from forsamling where for_id = 123;
NOTICE: QUERY PLAN:
Index Scan using forsamling_idx on forsamling (cost=0.00..2.01 rows=1
width=88)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Programmer/Networker [|] Magnus Naeslund
PGP Key: http://www.genline.nu/mag_pgp.txt
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2001-05-03 19:20:58 | Re: Packaging 7.1.1 |
Previous Message | Oleg Bartunov | 2001-05-03 19:09:40 | Re: Packaging 7.1.1 |