IS "! =" OR "NOT IN" BEST PRACTICE

Connectivity
Enthusiast

IS "! =" OR "NOT IN" BEST PRACTICE

we are currently using NOT IN clause for our SQL's. iam not sure if we can use != in place of NOT IN to increase the performance of the query.

please throw some lights on performance issues in using NOT IN or !=

thanks,
newtera
3 REPLIES

Re: IS "! =" OR "NOT IN" BEST PRACTICE

Don't use either! Not and "!" are both crap from a performance point of view. Avoid like the plague!

Re: IS "! =" OR "NOT IN" BEST PRACTICE

Anyway, they are different operators. In (whether Not or not) evaluates a series of values. Equals evaluates a single value. If you want to use != x and != y etc not only will your code look crap but it will also be slower as the execution plan has multiple statements to evaluate.

This is standard in all "normal" sql. I use the word normal becasue although I'm new to Teradata, I'm an experienced SQL developer. Teradata does not impress me one bit. It's slow, unresponsive and generally an antiquated application. Not sure of the history, but looking at the way it constructs stuff, I'd say it was originally a mainframe app. The developers appear to have taken the least cost route a modern development environment, and bugger the developers who actually need to use it.
Enthusiast

Re: IS "! =" OR "NOT IN" BEST PRACTICE

i can only laugh when you say "teradata is slow, unresponsive and generally an antiquated application" but i will excuse that as you are new to Teradata.
Teradata sql is equally compliant to ISO standards, if not more, than other RDBMSs.
Lets keep the performance discussion for another time when you get more acquainted with Teradata