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

LIKE search and performance

From: "Andy" <frum(at)ar-sd(dot)net>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: LIKE search and performance
Date: 2007-05-23 15:08:49
Message-ID: 009501c79d4c$445428f0$0b00a8c0@mpsro.dom (view raw or flat)
Thread:
Lists: pgsql-performance
Hi, 
 
I have a table with varchar and text columns, and I have to search through
these text in the whole table. 
 
An example would be:
SELECT * FROM table
                             WHERE name like '%john%' or street like '%srt%'
 
Anyway, the query planner always does seq scan on the whole table and that
takes some time. How can this be optimized or made in another way to be
faster?
 
I tried to make indexes on the columns but no success. 
 
PG 8.2
 
Regards,
Andy.

Responses

pgsql-performance by date

Next:From: Vivek KheraDate: 2007-05-23 15:47:27
Subject: Re: performance drop on 8.2.4, reverting to 8.1.4
Previous:From: Tom LaneDate: 2007-05-23 14:01:06
Subject: Re: does VACUUM ANALYZE complete with this error?

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