Home » RDBMS Server » Performance Tuning » Which is faster (10g)
Which is faster [message #353758] Wed, 15 October 2008 00:48 Go to next message
maheshmhs
Messages: 93
Registered: October 2008
Location: Nepal
Member
i have to perform copmarision in a very large database.
I would like to know if it is faster to compare individual fields
eg
a.name = b.name and
a.roll = b.roll


Or concatenate them and compare

eg

a.name||a.roll = b.name||b.roll

please respond.

thank you
Re: Which is faster [message #353770 is a reply to message #353758] Wed, 15 October 2008 01:13 Go to previous messageGo to next message
Michel Cadot
Messages: 64151
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
The second one is not equivalent to the first one, so performances comparison is irrelevant.

Regards
Michel
Re: Which is faster [message #353784 is a reply to message #353770] Wed, 15 October 2008 01:59 Go to previous messageGo to next message
maheshmhs
Messages: 93
Registered: October 2008
Location: Nepal
Member
thanx. but i think i should clarify the situation...

i have two tables say a and c
i have to insert rows from c into a if certain fielddata is not present in a.(say name and roll)

here i create a table b that contains both name and roll from table c.

so,
when i insert , i first compare fields from b and a. if the data is not present in a, i insert the data.

so when inserting, i use
insert into a
(name,roll,...)
from
select
(name, roll,.....)
from c
where
not
exists
(
select * from b
where

a.name = b.name and
a.roll = b.roll
)
---
last two lines is of concern to me.
which one is faster..

a.name = b.name and
a.roll = b.roll

--
or
--
a.name||a.roll = b.name||b.roll
--

Re: Which is faster [message #353801 is a reply to message #353784] Wed, 15 October 2008 02:53 Go to previous messageGo to next message
Michel Cadot
Messages: 64151
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Same answer.
You should try to understand it.

Regards
Michel
Re: Which is faster [message #354085 is a reply to message #353801] Thu, 16 October 2008 06:45 Go to previous message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Michel is saying that:

('ABC','DEF') and ('AB','CDEF') are not equal, but

('ABC' || 'DEF') and ('AB' || 'CDEF') ARE equal.

Forget the concatenation. Theoretically, the concatenation is another operator for the engine to perform, and it must also write the result to a new memory location.

Just use the two conditions and try not to over-think it.

Ross Leishman
Previous Topic: Performance issue with RETURNING BULK COLLECT clause
Next Topic: need help to tune the query
Goto Forum:
  


Current Time: Fri Dec 09 19:33:59 CST 2016

Total time taken to generate the page: 0.08325 seconds