Skip site navigation (1) Skip section navigation (2)

Re: is it possible to get the optimizer to use indexes

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: is it possible to get the optimizer to use indexes
Date: 2003-12-19 03:08:37
Message-ID: 1071803317.1629.16.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: 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
> 
> 


In response to

Responses

pgsql-performance by date

Next:From: Christopher BrowneDate: 2003-12-19 03:22:38
Subject: Re: is it possible to get the optimizer to use indexes with a like clause
Previous:From: Christopher Kings-LynneDate: 2003-12-19 01:38:50
Subject: Re: is it possible to get the optimizer to use indexes

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group