Skip to content
Advertisement

Db2: perfomant way to check if item exists

what will be the fastest way to check if a specific item exists in table or not.

I am evaluating the result of this select, but will be there a faster and Performance way?

Advertisement

Answer

This depends on what you want to do with the result.
It’s generally not recommended to use aggregate functions, since you don’t need to scan all matches – you need just one of them at most.

If it’s some procedure logic:

If it’s just a result of a single query:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement