postgres 7.1.3: why does the query plan ignore indexes?

From: Marco Vezzoli <marco(dot)vezzoli(at)st(dot)com>
To: sql <pgsql-sql(at)postgresql(dot)org>
Subject: postgres 7.1.3: why does the query plan ignore indexes?
Date: 2003-08-19 08:43:47
Message-ID: 3F41E343.AE3B5E@st.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,
I know this question was asked many times, but please help me understand
what I am doing wrong.
I work with a postgresql 7.1.3 on Solaris 8 compiled with gcc 3.0.2

Some indexes are defined on a table

ewsweb_test=> \d measures_product
Index "measures_product"
Attribute | Type
------------+----------
product_id | smallint
btree

ewsweb_test=> \d measures_date
Index "measures_date"
Attribute | Type
-----------+--------------------------
date | timestamp with time zone
btree

but the query seems to ignore it.

ewsweb_test=> explain select zero_yield, gross from measures where
product_id=29 and date between '2003-03-12' and '2003-08-14';
NOTICE: QUERY PLAN:

Seq Scan on measures (cost=0.00..12937.76 rows=254 width=12)

EXPLAIN

I know there is an option that alter the seq scan cost but I prefer to
leave the optimizer as clean as possible.
Thanks in advence for any help.
Marco

--
Marco Vezzoli tel. +39 039 603 6852
STMicroelectronics fax. +39 039 603 5055

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message shyamperi 2003-08-19 10:52:11 Migration from db2 to postgres'
Previous Message Chidananda 2003-08-19 08:32:41 Configuring Problem on Solaris............