Lets say, I have a query,
SELECT * FROM MyTable WHERE MyParam = 0 OR MyColumn = MyParam
Here MyParam is parameter and optional. So, it only check MyColumn = MyParam
if MyParam is not 0. But our DBA is saying OR will makes it slow and db will suffers. Another option is,
IF MyParam = 0
SELECT * FROM MyTable WHERE MyColumn = MyParam
The problem with this approach is that we have lot of optional parameters. So, our query become very very big. Another option is CASE.
So what you guys suggest. I am talking about in general whether Oracle or SQL Server.