Imagine I have the following query (translated from JDBC):
select ta.indexedColumnA, tb.indexedColumnB
from tableA ta join tableB tb on ta.id=tb.foreignKeyA
where ta.id in (@listOfIds)
Now, the param @listOfIds can be a list with some ids (let's say [0,10] usually).
- In case it's an empty list, is the query optimiser able to do some optimisation (such as return an empty result) ?
- does the capability of optimising (short-circuit) depends on something we can control?
(I'm not sure of postgres version, will update as soon as I can be sure)
in ()is invalid SQLnullinstead of nothing as parameter?where ta.id in (null)