From: Dave Cramer <pg@fastcrypt.com>
To: Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Cc: pgsql-performance@postgresql.org
Subject: Re: is it possible to get the optimizer to use indexes
Date: 18 Dec 2003 22:08:37 -0500
Message-ID: <1071803317.1629.16.camel@localhost.localdomain> (raw)
In-Reply-To: <3FE256AA.8000707@familyhealth.com.au>
References: <3FE1F5A1.6080908@geizhals.at>
<60n09q9bqg.fsf@dev6.int.libertyrms.info>
<1071789528.1629.10.camel@localhost.localdomain>
<3FE256AA.8000707@familyhealth.com.au>
after vacuum verbose analyze, I still get
explain select * from isppm where item_upc_cd like '06038301234';
QUERY PLAN
-----------------------------------------------------------------------
Seq Scan on isppm (cost=100000000.00..100009684.89 rows=2 width=791)
Filter: (item_upc_cd ~~ '06038301234'::text)
(2 rows)
isp=# explain select * from isppm where item_upc_cd = '06038301234';
QUERY PLAN
------------------------------------------------------------------------
Index Scan using isppm_x0 on isppm (cost=0.00..5.86 rows=2 width=791)
Index Cond: (item_upc_cd = '06038301234'::bpchar)
(2 rows)
Dave
On Thu, 2003-12-18 at 20:38, Christopher Kings-Lynne wrote:
> > It appears that the optimizer only uses indexes for = clause?
>
> The optimizer will used indexes for LIKE clauses, so long as the clause
> is a prefix search, eg:
>
> SELECT * FROM test WHERE a LIKE 'prf%';
>
> Chris
>
>
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-performance@postgresql.org
Cc: pg@fastcrypt.com, chriskl@familyhealth.com.au
Subject: Re: is it possible to get the optimizer to use indexes
In-Reply-To: <1071803317.1629.16.camel@localhost.localdomain>
* 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