Click here to Skip to main content
15,906,569 members
Home / Discussions / Database
   

Database

 
AnswerRe: doubt in cross join Pin
Mycroft Holmes21-Nov-08 23:26
professionalMycroft Holmes21-Nov-08 23:26 
GeneralRe: doubt in cross join Pin
deepthy.p.m23-Nov-08 17:48
deepthy.p.m23-Nov-08 17:48 
QuestionSql reporting Pin
member2721-Nov-08 20:25
member2721-Nov-08 20:25 
QuestionUDF's in Stored Procedures (not using)... Pin
Andy_L_J21-Nov-08 17:04
Andy_L_J21-Nov-08 17:04 
AnswerRe: UDF's in Stored Procedures (not using)... Pin
Wendelius21-Nov-08 23:15
mentorWendelius21-Nov-08 23:15 
AnswerRe: UDF's in Stored Procedures (not using)... Pin
Mycroft Holmes21-Nov-08 23:20
professionalMycroft Holmes21-Nov-08 23:20 
GeneralRe: UDF's in Stored Procedures (not using)... Pin
Wendelius21-Nov-08 23:58
mentorWendelius21-Nov-08 23:58 
GeneralRe: UDF's in Stored Procedures (not using)... Pin
Ben Fair25-Nov-08 4:16
Ben Fair25-Nov-08 4:16 
Yes, if you don't lead the condition with a wildcard (% or ?) then, using LIKE is much faster than =. So:

WHEN pt.name LIKE 'EX%'


will be much faster that:

WHEN left(pt.name, 2) = 'EX'


For one, the LEFT() function is being called on each row in the result set and then comparing the result against a string constant; whereas with the LIKE with the wildcard at the end will bypass the functio call and cause the engine to utilize the indexes (if any) to find matches on the string comparison. I'm not sure why, but from my experience whatever it's doing under the hood causes LIKE to generally out-perform =.

Similar to previous suggestions I'd move the value lookup out of a UDF either into the query itself, a CTE (Common Table Expression), an inline view, or a persistent view. They'll probably all give about the same performance, the choice would just depend on your needs. Since you mention it being used in many places, offhand it seems the persistent view would be the best option.

Keep It Simple Stupid! (KISS)

QuestionKeeping track of Pin
CodingYoshi21-Nov-08 9:16
CodingYoshi21-Nov-08 9:16 
AnswerRe: Keeping track of Pin
Mycroft Holmes21-Nov-08 13:06
professionalMycroft Holmes21-Nov-08 13:06 
AnswerFunction for Status Pin
David Mujica21-Nov-08 13:39
David Mujica21-Nov-08 13:39 
GeneralRe: Function for Status Pin
Mycroft Holmes21-Nov-08 23:12
professionalMycroft Holmes21-Nov-08 23:12 
AnswerRe: Keeping track of Pin
Wendelius21-Nov-08 23:43
mentorWendelius21-Nov-08 23:43 
Questionconvert from MSAccess to Oracle Pin
sajid.salim.khan21-Nov-08 5:46
sajid.salim.khan21-Nov-08 5:46 
AnswerRe: convert from MSAccess to Oracle Pin
David Mujica21-Nov-08 6:01
David Mujica21-Nov-08 6:01 
GeneralRe: convert from MSAccess to Oracle Pin
sajid.salim.khan21-Nov-08 6:15
sajid.salim.khan21-Nov-08 6:15 
QuestionImport excel to Sql server Pin
Abhilash121-Nov-08 3:02
Abhilash121-Nov-08 3:02 
AnswerRe: Import excel to Sql server Pin
indian14321-Nov-08 3:20
indian14321-Nov-08 3:20 
AnswerRe: Import excel to Sql server Pin
indian14321-Nov-08 8:23
indian14321-Nov-08 8:23 
AnswerRe: Import excel to Sql server Pin
Jerry Hammond21-Nov-08 14:06
Jerry Hammond21-Nov-08 14:06 
AnswerRe: Import excel to Sql server Pin
Wendelius21-Nov-08 22:19
mentorWendelius21-Nov-08 22:19 
AnswerRe: Import excel to Sql server Pin
indian14324-Nov-08 0:43
indian14324-Nov-08 0:43 
GeneralRe: Import excel to Sql server Pin
Wendelius24-Nov-08 3:38
mentorWendelius24-Nov-08 3:38 
QuestionHow to identify if an SQL query times out [modified] Pin
indian14321-Nov-08 1:31
indian14321-Nov-08 1:31 
AnswerRe: How to identify if an SQL query times out Pin
Wendelius21-Nov-08 6:24
mentorWendelius21-Nov-08 6:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.