Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Which one is faster?

Re: Which one is faster?

From: Niall Litchfield <niall.litchfield_at_dial.pipex.com>
Date: Wed, 7 Jul 2004 22:24:20 +0100
Message-ID: <40ec69f1$0$6444$cc9e4d1f@news-text.dial.pipex.com>


queries that ask the right questions, *and only* the right questions have their place as well....

-- 
Niall Litchfield
Oracle DBA
http://www.niall.litchfield.dial.pipex.com
"Ed prochak" <ed.prochak_at_magicinterface.com> wrote in message
news:4b5394b2.0407071139.3a441a1_at_posting.google.com...
> "Oracle Newbie" <f93c0532_at_yahoo.com> wrote in message
news:<2l1dfuF7cgu4U1_at_uni-berlin.de>...

> > "Sybrand Bakker" <sybrandb_at_hccnet.nl> wrote in message
> > news:phvme0p53ds1h41i8efbgmlqjqj034d6pq_at_4ax.com...
> > > On Wed, 7 Jul 2004 09:32:24 +0500, "Oracle Newbie"
> > > <f93c0532_at_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 )
> > while the first one results in a state machine, it has to search the > string (ie check each character) from the beginning. The > function-based one merely counts the characters. > >
> > > BTW: any reason you didn't try it yourself?
> >
> > How can I test for speed? I'm using Toad 7.6
> >
> > thx
> > > --
> > > Sybrand Bakker, Senior Oracle DBA
> > > The real question is: why do you care about the speed? > > I suggest you learn to write queries that produce the right answers > before concerning yourself with performance issues. No matter how fast > the wrong answer comes back, it's still wrong. > > HTH, > ed
Received on Wed Jul 07 2004 - 16:24:20 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US