My Indices doesn't work

From: Martin Dolog <martin_dolog(at)tempest(dot)sk>
To: pgsql-sql(at)postgresql(dot)org
Subject: My Indices doesn't work
Date: 2000-08-15 08:34:56
Message-ID: 399900B0.6252E318@tempest.sk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi *,

I have pgsql7.0.2 on Linux2.2.16 and table with following indices:

CREATE TABLE T1 (NUM INT NOT NULL, NAME VARCHAR(10) NOT NULL, POP
VARCHAR(10) NOT NULL);
CREATE INDEX T1_I_NUM ON T1(NUM);
CREATE INDEX T1_I_NAME ON T1(NAME);
CREATE INDEX T1_I_POP ON T1(POP);

... and some data, but I really don't understant how indices work, look
at that:

template1=# explain select * from t1 where num=2;
NOTICE: QUERY PLAN:
Index Scan using t1_i_num on t1 (cost=0.00..8.14 rows=10 width=28)

what is ok, ***BUT***

template1=# explain select * from t1 where num>2;
NOTICE: QUERY PLAN:
Seq Scan on t1 (cost=0.00..22.50 rows=333 width=28)

WHY SEQ SCAN ?!!?

thank you

--

#md

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Volker Krebs 2000-08-15 08:43:06 Language dependent fields
Previous Message Thomas Swan 2000-08-15 06:18:14 Functions with Null Arguments?