Re: is it possible to get the optimizer to use indexes - Mailing list pgsql-performance

From Dave Cramer
Subject Re: is it possible to get the optimizer to use indexes
Date
Msg-id 1071803317.1629.16.camel@localhost.localdomain
Whole thread Raw
In response to Re: is it possible to get the optimizer to use indexes  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Responses Re: is it possible to get the optimizer to use indexes
Re: is it possible to get the optimizer to use indexes
List pgsql-performance
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
>
>


pgsql-performance by date:

Previous
From: Christopher Kings-Lynne
Date:
Subject: Re: is it possible to get the optimizer to use indexes
Next
From: Christopher Browne
Date:
Subject: Re: is it possible to get the optimizer to use indexes with a like clause