Why is it not using an index?

From: Dmitry Tkach <dmitry(at)openratings(dot)com>
To: pgsql-general(at)postgresql(dot)org(dot)pgsql-sql(at)postgresql(dot)org
Subject: Why is it not using an index?
Date: 2002-03-15 19:07:44
Message-ID: 3C924680.4090806@openratings.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

This must be really simple, but I just can't get it :-(
I have a table (a) with a single column (x):

Table "a"
Attribute | Type | Modifier
-----------+----------+----------
x | smallint |
Index: a_idx

Index "a_idx"
Attribute | Type
-----------+----------
x | smallint
btree

The table has 10000000 rows....

Now, how come, when I do:

explain select * from a where x=3;

it says:

Seq Scan on bset (cost=100000000.00..100175934.05 rows=303 width=2)

Why is it not using a_idx???

I even tried set enable_seqscan to off - makes no difference :-(

Any idea what is going on?

Thanks a lot!

Dima

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dmitry Tkach 2002-03-15 19:09:21 Re: Why is it not using an index? (small correction)
Previous Message Jeffrey W. Baker 2002-03-15 18:35:38 Re: more about pg_toast growth

Browse pgsql-sql by date

  From Date Subject
Next Message Dmitry Tkach 2002-03-15 19:09:21 Re: Why is it not using an index? (small correction)
Previous Message Josh Berkus 2002-03-15 18:53:43 Re: JDBC for J2ME