Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 278FA9FB64C for ; Thu, 24 May 2007 04:01:15 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 47167-07 for ; Thu, 24 May 2007 04:00:58 -0300 (ADT) X-Greylist: delayed 15:54:53.833718 by SQLgrey-1.7.5 Received: from ar-sd.net (unknown [212.146.96.162]) by postgresql.org (Postfix) with ESMTP id 9410E9FB666 for ; Thu, 24 May 2007 04:01:00 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ar-sd.net (Postfix) with ESMTP id A1425129ED; Thu, 24 May 2007 10:00:58 +0300 (EEST) Received: from ar-sd.net ([127.0.0.1]) by localhost (ar-sd.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 05780-03; Thu, 24 May 2007 10:00:39 +0300 (EEST) Received: from andypc (andypc.mpsro.dom [192.168.0.11]) by ar-sd.net (Postfix) with ESMTP id 5672612961; Thu, 24 May 2007 10:00:39 +0300 (EEST) From: "Andy" To: "'Rigmor Ukuhe'" Cc: Subject: Re: LIKE search and performance Date: Thu, 24 May 2007 10:03:42 +0300 Message-ID: <002101c79dd1$aa0f8ce0$0b00a8c0@mpsro.dom> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Thread-Index: AcedVjqlqJfXNyV8QXSKnTWIF8mYGwAe1koA In-Reply-To: <46546335.5000109@finestmedia.ee> X-Virus-Scanned: by amavisd-new at ar-sd.net X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/475 X-Sequence-Number: 24865 Thank you all for the answers. I will try your suggestions and see what that brings in terms of performance. Andy. > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of > Rigmor Ukuhe > Sent: Wednesday, May 23, 2007 6:52 PM > Cc: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] LIKE search and performance > > Andy wrote: > > 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? > > Use tsearch2 > (http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/) for > full text indexing. > > Rigmor > > > > > I tried to make indexes on the columns but no success. > > > > PG 8.2 > > > > Regards, > > Andy. > > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > >