Path: news.easynews.com!core-easynews!newsfeed3.easynews.com!easynews.com!easynews!news.glorb.com!newsgate.cistron.nl!skynet.be!skynet.be!bnewsoutpeer01.bru.ops.eu.uu.net!bnewsinpeer01.bru.ops.eu.uu.net!bnewspost00.bru.ops.eu.uu.net!emea.uu.net!not-for-mail
From: "Niall Litchfield" <niall.litchfield@dial.pipex.com>
Newsgroups: comp.databases.oracle.misc
References: <2l1clgF76p3oU1@uni-berlin.de> <phvme0p53ds1h41i8efbgmlqjqj034d6pq@4ax.com> <2l1dfuF7cgu4U1@uni-berlin.de>
Subject: Re: Which one is faster?
Date: Wed, 7 Jul 2004 10:04:53 +0100
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
Lines: 46
Message-ID: <40ebbca7$0$6444$cc9e4d1f@news-text.dial.pipex.com>
NNTP-Posting-Date: 07 Jul 2004 09:04:39 GMT
NNTP-Posting-Host: 81-178-73-254.dsl.pipex.com
X-Trace: 1089191079 news-text.dial.pipex.com 6444 81.178.73.254:4174
X-Complaints-To: abuse@uk.uu.net
Xref: core-easynews comp.databases.oracle.misc:111526
X-Received-Date: Wed, 07 Jul 2004 02:03:54 MST (news.easynews.com)

"Oracle Newbie" <f93c0532@yahoo.com> wrote in message
news:2l1dfuF7cgu4U1@uni-berlin.de...
>
> "Sybrand Bakker" <sybrandb@hccnet.nl> wrote in message
> news:phvme0p53ds1h41i8efbgmlqjqj034d6pq@4ax.com...
> > On Wed, 7 Jul 2004 09:32:24 +0500, "Oracle Newbie"
> > <f93c0532@yahoo.com> wrote:
> >
> > >I have a string of thousands of characters and I want to check if it
ends
> > >with '>>' There are 2 ways of doing it ( or more maybe)
> > >
> > >If  big_str like '%>>' Then
> > >
> > >OR
> > >
> > >If  substr(big_str ,  length(big_str) - 1 ,  2 ) = '>>' Then
> > >
> > >Which one is faster? obviously the 1st one is simpler.
> > >
> > >Or is there a better way?
> > >
> > >thx
> > >
> >
> > The second looks faster to me.
>
> Why? ( esp. when it contains two functions )

Well apart from anything else, the function based version can be indexed if
the performance is important.

> > BTW: any reason you didn't try it yourself?
>
> How can I test for speed? I'm using Toad 7.6

generate some representative test data and time several runs, even better
use real data and time several runs.


-- 
Niall Litchfield
Oracle DBA
http://www.niall.litchfield.dial.pipex.com


