Search Postgresql Archives

Short circuit evaluation of expressions in query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

 

 


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux