Re: Is it possible to search for sub-strings... - Mailing list pgsql-general

From Steve Heaven
Subject Re: Is it possible to search for sub-strings...
Date
Msg-id 3.0.1.32.20000919170639.00e6207c@mail.thornet.co.uk
Whole thread Raw
In response to Re: Is it possible to search for sub-strings...  ("Mitch Vincent" <mitch@venux.net>)
Responses Re: Is it possible to search for sub-strings...  (Vince Vielhaber <vev@michvhf.com>)
List pgsql-general
At 09:00 19/09/00 -0700, Mitch Vincent wrote:
>LIKE can use indexes, ~* can not, that's LIKE's main advantage (at least in
>my opinion).
>

~ does use indexes, ~* doesnt,
 but then nor does the equivalent upper(columnname) LIKE 'TERM'. Make sure
you're comparing apples with apples.


explain select * from all_title_fti where string like 'A%';
NOTICE:  QUERY PLAN:

Index Scan using all_title_idx on all_title_fti  (cost=86633.57 rows=1
width=16)

 explain select * from all_title_fti where string ~ '^A';
NOTICE:  QUERY PLAN:

Index Scan using all_title_idx on all_title_fti  (cost=86633.57 rows=1
width=16

 explain select * from all_title_fti where upper(string) like 'A%';
NOTICE:  QUERY PLAN:

Seq Scan on all_title_fti  (cost=170921.58 rows=1083414 width=16)
--
thorNET  - Internet Consultancy, Services & Training
Phone: 01454 854413
Fax:   01454 854412
http://www.thornet.co.uk

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Can't connect to 6.5.2 server with 7.0.2 client
Next
From: "Mitch Vincent"
Date:
Subject: Re: Is it possible to search for sub-strings...