From: Chris Hoover <revoohc@gmail.com>
To: pgsql-admin@postgresql.org Admin <pgsql-admin@postgresql.org>
Subject: any way to make query use index?
Date: Thu, 15 Nov 2007 10:14:41 -0500
Message-ID: <1d219a6f0711150714j6f192548xe4c134a25e5b57b2@mail.gmail.com> (raw)
I am working through our application looking for ways to eliminate seq
scans in our database. I am looking for some help with this query.
SELECT rev_desc FROM rev_code_desc WHERE rev_code = lpad('0300', 4, '0')
Is there anyway to make postgres use an index on this query?
Here is the table definition:
CREATE TABLE rev_code_desc
(
rev_code character(4) NOT NULL,
rev_desc text,
user_id character varying(12),
live_rec boolean DEFAULT true,
CONSTRAINT rev_code_desc_pkey PRIMARY KEY (rev_code)
)
Right now, I can't seem to get it to use an index for this type of
query. Of course, in our application it is SELECT rev_desc FROM
rev_code_desc WHERE rev_code = lpad(<program variable>, 4, '0').
Thanks for any help,
Chris
PG 8.1.3
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-admin@postgresql.org
Cc: revoohc@gmail.com
Subject: Re: any way to make query use index?
In-Reply-To: <1d219a6f0711150714j6f192548xe4c134a25e5b57b2@mail.gmail.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