Problem with indicies...

Started by Andy Farrellover 27 years ago1 messageshackers
Jump to latest
#1Andy Farrell
andy_farrell@itd.sterling.com

REGARDING Problem with indicies...

I'm having trouble getting indicies to be used when performing various
"covered" queries.

For example see the following table, index and query.

CREATE TABLE JDSFTRATT
(
ATT_CODE char(3),
DS_ID int,
FTR_ID int,
ATT_VALUE float,
ATT_TEXT varchar(128) )
;

create index jdsftratt_b_ds_id_ftr_id
on jdsftratt
using btree (ds_id int4_ops, ftr_id int4_ops, att_code char4_ops, att_value
float8_ops);

select ftr_id from jdsftratt;

As per the explain command, a "Seq Scan" (see explain command output below)
is being performed by postgres for the above query. Also, why would
sequential scan be performed by postgres given a select count(*) on and
indexed table?

explain select ftr_id from jdsftratt;

Seq Scan on jdsftratt (cost=90889.78 size=2134660 width=4)

I have verified that the index exists via querying the system tables. I'm
using postgres 6.3.2 on Sun Ultra 10 running Solaris. Any help would be
appreciated on this.

Andy