why does explain tell me I'm using a seq scan? - Mailing list pgsql-general

From Mark Harrison
Subject why does explain tell me I'm using a seq scan?
Date
Msg-id 3FAC34CE.9020701@pixar.com
Whole thread Raw
Responses Re: why does explain tell me I'm using a seq scan?  (Rod Taylor <pg@rbt.ca>)
Re: why does explain tell me I'm using a seq scan?  (Adam Ruth <aruth@intercation.com>)
List pgsql-general
I have indexed two columns in a table.  Can somebody explain to me why
the first query below uses an Index Scan while the second uses a Seq
Scan?

Many TIA!
Mark


planb=# \d abcs
                                Table "public.abcs"
   Column   |          Type          |                   Modifiers
-----------+------------------------+-----------------------------------------------
  abcid   | integer                | not null default nextval('abcid_seq'::text)
  type      | character varying(255) |
  versionof | integer                |
Indexes: abcs_pkey primary key btree (abcid),
          abcs_versionof btree (versionof)

planb=# explain select type from abcs where abcid = 6339;
                                  QUERY PLAN
----------------------------------------------------------------------------
  Index Scan using abcs_pkey on abcs  (cost=0.00..6.01 rows=1 width=145)
    Index Cond: (abcid = 6339)
(2 rows)

planb=# explain select type from abcs where versionof = 6339;
                            QUERY PLAN
----------------------------------------------------------------
  Seq Scan on abcs  (cost=0.00..59182.10 rows=16137 width=145)
    Filter: (versionof = 6339)
(2 rows)


pgsql-general by date:

Previous
From: "Edwin Quijada"
Date:
Subject: Re: Recovery Data Cant Be!!!
Next
From: Rod Taylor
Date:
Subject: Re: why does explain tell me I'm using a seq scan?