How to force the parser to use index scan instead of sequential scan - Mailing list pgsql-general

From ck
Subject How to force the parser to use index scan instead of sequential scan
Date
Msg-id 1160199136.689868.167010@c28g2000cwb.googlegroups.com
Whole thread Raw
Responses Re: How to force the parser to use index scan instead of sequential scan  ("Jaime Casanova" <systemguards@gmail.com>)
List pgsql-general
Hello,

         I am using PostgreSQL 7.3.2. I have a large table in a
database , its primary key field is int8.
Almost all of my queries are written relaing to that field. That field
is B-Tree indexed. When i check the query plan i found that all the
queries are using sequential scan and index was not used. So my queries
are likely to be slow. But when i tried to convert the values given to
that field to int8 in a where condition then the parser is using the
index scan, Eg
select * from h057 where h057001 = 1142::int8
the above query uses index scan
select * from h057 where h057001 = 1142
the above query uses sequential scan.
Since there are large number of queries written and being used in the
production it is impossible to change all the queries. Please help me
by giving a suggestion to improve my query performance. I mean any
configuration level changes that helps to force the parser to use index
scan instead of sequential scan in the above case.
Thanks in advance.

ck


pgsql-general by date:

Previous
From: Matthew Peter
Date:
Subject: Re: increment row number function question
Next
From: Rafal Pietrak
Date:
Subject: predefined functions