pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dmitry Tkach <dmitry@openratings.com>
To: pgsql-general@postgresql.org.pgsql-sql
Subject: Why is it not using an index?
Date: Fri, 15 Mar 2002 14:07:44 -0500
Message-ID: <3C924680.4090806@openratings.com> (raw)

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




view thread (11+ messages)  latest in thread

Message-ID: <3C924680.4090806@openratings.com>
Permalink:  ../3C924680.4090806@openratings.com/
Also on:    postgresql.org/message-id/3C924680.4090806@openratings.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dmitry@openratings.com, pgsql-general@postgresql.org.pgsql-sql
  Subject: Re: Why is it not using an index?
  In-Reply-To: <3C924680.4090806@openratings.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox