pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: mallah@trade-india.com
To: josh@agliodbs.com
Cc: mallah@trade-india.com
Cc: pgsql-sql@postgresql.org
Subject: Re: getting ILIKE or  ~*  to use indexes....
Date: Sun, 11 Aug 2002 02:44:17 +0530 (IST)
Message-ID: <49280.203.145.129.36.1029014057.squirrel@mail.trade-india.com> (raw)
In-Reply-To: <web-1607387@davinci.ethosmedia.com>
References: <200208101143.54041.mallah@trade-india.com>
	<web-1607387@davinci.ethosmedia.com>


Thanks Josh

I normally use tsearch for full text search i will probably use that
or may be this what u suggested.

regds
mallah.


> Rajesh,
>
>> I want my query to use indexes for company name searches but its not happening unless
>> is use '=' which does not server the purpose.
>>
>> eg
>>
>> tradein_clients=# explain SELECT co_name  FROM unified_data  where co_name  ilike '%rajesh%' ;
>
> Well, for an *anchored* case-insensitive search, you can create an index on lower(field_name)
> to use an index.
>
> CREATE INDEX idx_uni_co_name ON unifed_data(lower(co_name));
> SELECT co_name  FROM unified_data  where
> lower(co_name) LIKE (lower('rajesh') || '%') ;
>
> And that will use the index.
>
> However, what you are doing is an *unanchored* text search, meaning that you are searching for
> 'rajesh' anywhere in the field.  No standard index can help you with that.
>
> Instead, you should look into Full Text Search tools.  There's a simple one in /contrib in the
> Postgresql source, and an more robust one
> available from the OpenFTS project.
>
> -Josh Berkus



-----------------------------------------
Get your free web based email at trade-india.com.
   "India's Leading B2B eMarketplace.!"
http://www.trade-india.com/





view thread (3+ messages)

Message-ID: <49280.203.145.129.36.1029014057.squirrel@mail.trade-india.com>
Permalink:  ../49280.203.145.129.36.1029014057.squirrel@mail.trade-india.com/
Also on:    postgresql.org/message-id/49280.203.145.129.36.1029014057.squirrel@mail.trade-india.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mallah@trade-india.com, josh@agliodbs.com
  Subject: Re: getting ILIKE or  ~*  to use indexes....
  In-Reply-To: <49280.203.145.129.36.1029014057.squirrel@mail.trade-india.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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