Is there a performance hit selecting rows based upon a constructed CASE column?

Analytics
Enthusiast

Is there a performance hit selecting rows based upon a constructed CASE column?

Hi,

Quick question. I think there is no difference, but I need to be sure.

In a SELECT or INSERT statement if I use a CASE statement to create a new column and then select rows based upon the value of that new column, is it any slower (or faster) than simply repeating the logic of the CASE statement as a direct WHERE condition?

I'm processing a *lot* of data with nasty string functions and I need every ounce of optimisation I can get :)

Thanks

Tim
1 REPLY
Senior Apprentice

Re: Is there a performance hit selecting rows based upon a constructed CASE column?

Hi Ti,
you're right, there's no difference.
Btw, if you want to lower CPU usage, stay away from conversions involving type casts from char to numeric/date and vice versa.

Dieter