Say I have the following parameterized query in a function:
select * from foo where ($1 = -1 or foo.status = $1) and (…)
where the (…) part consists of more parameterized conditions similar to the first one.
Suppose that at runtime, $1 is supplied a value of -1, does the foo.status = $1 condition still have to be evaluated?
Assuming the $1 = -1 case, should the above query be as fast as the following?
select * from foo where (…)
Thanks
Jimmy