Home » RDBMS Server » Performance Tuning » Does Concatenation in SQL query effect performance
Does Concatenation in SQL query effect performance [message #223139] Wed, 07 March 2007 13:19 Go to next message
kirso491
Messages: 8
Registered: October 2006
Junior Member
Does Concatenation in a SQL query effect performance
Re: Does Concatenation in SQL query effect performance [message #223142 is a reply to message #223139] Wed, 07 March 2007 13:24 Go to previous messageGo to next message
kirso491
Messages: 8
Registered: October 2006
Junior Member
I mean, If concatenation is used in the where clause like

Select -- from -- where (x || y || z) in (select x|| y || z from --)
Re: Does Concatenation in SQL query effect performance [message #223143 is a reply to message #223142] Wed, 07 March 2007 13:42 Go to previous messageGo to next message
gintsp
Messages: 118
Registered: February 2007
Senior Member
Of course it affects performance. Generally every operation affects performance.
BUT
You have even bigger potential problem here because if you think that you are comparing x to x, y to y and z to z, then you are wrong.
Think what if in upper select X = 'AB', Y = 'C', Z = 'D'
and in subselect X = 'A', Y = 'B', Z = 'CD'

You'll get the match, but most probably you don't want that.

Ok, there isn't any problem just use following statement
select * from big 
where (owner, name, type) in (
  select owner, name, type from big
);


Of course be cautious also with null values and "in" operator!

Gints Plivna
http://www.gplivna.eu
Re: Does Concatenation in SQL query effect performance [message #223144 is a reply to message #223139] Wed, 07 March 2007 13:44 Go to previous messageGo to next message
najehas
Messages: 10
Registered: March 2007
Junior Member
hi ithink YES it will effect the performance and the best to ensure that is to notice and mesure the diff between tow selects
Re: Does Concatenation in SQL query effect performance [message #223154 is a reply to message #223139] Wed, 07 March 2007 14:59 Go to previous message
kirso491
Messages: 8
Registered: October 2006
Junior Member
Thank you for the answers
Previous Topic: is there any limit for number of connections on a listner port
Next Topic: Reverse Key Index
Goto Forum:
  


Current Time: Thu May 16 00:58:53 CDT 2024