pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
LIKE search with ending % not optimized in v8
2+ messages / 2 participants
[nested] [flat]

* LIKE search with ending % not optimized in v8
@ 2005-06-22 09:03 Aditya Damle <aditya@skillnetinc.com>
  2005-06-28 05:16 ` Re: LIKE search with ending % not optimized in v8 Michael Fuhr <mike@fuhr.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Aditya Damle @ 2005-06-22 09:03 UTC (permalink / raw)
  To: pgsql-performance

Hello. I believe in earlier versions, a query of the
form 
select attrib from ttt where attrib like 'foo%' would
be able to take advantage of an index. I have seen
this in the past. Currently I am using v8.0.3. From
what I can see is that the execultion plan seems to
use a seq scan and to totally ignore the index. Is
this the case?

-Aditya




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: LIKE search with ending % not optimized in v8
  2005-06-22 09:03 LIKE search with ending % not optimized in v8 Aditya Damle <aditya@skillnetinc.com>
@ 2005-06-28 05:16 ` Michael Fuhr <mike@fuhr.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Fuhr @ 2005-06-28 05:16 UTC (permalink / raw)
  To: Aditya Damle <aditya@skillnetinc.com>; +Cc: pgsql-performance

On Wed, Jun 22, 2005 at 02:03:29AM -0700, Aditya Damle wrote:
>
> Hello. I believe in earlier versions, a query of the
> form 
> select attrib from ttt where attrib like 'foo%' would
> be able to take advantage of an index. I have seen
> this in the past. Currently I am using v8.0.3. From
> what I can see is that the execultion plan seems to
> use a seq scan and to totally ignore the index. Is
> this the case?

8.0.3 can certainly use indexes for LIKE queries, but the planner
will choose a sequential scan if it thinks that would be faster.
Have you vacuumed and analyzed your tables?  Could you post the
EXPLAIN ANALYZE output of a query, once with enable_seqscan turned
on and once with it turned off?

See also "Operator Classes" in the "Indexes" chapter of the
documentation:

http://www.postgresql.org/docs/8.0/static/indexes-opclass.html

What locale are you using?

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-06-28 05:16 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-06-22 09:03 LIKE search with ending % not optimized in v8 Aditya Damle <aditya@skillnetinc.com>
2005-06-28 05:16 ` Michael Fuhr <mike@fuhr.org>

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