If I have the following toy request
SELECT *
FROM my_tables
WHERE my_id in (
SELECT my_other_id
FROM my_other_tables
) AND some_slow_func(arg) BETWEEN 1 AND 2;
Will the first condition in the WHERE clause short-circuit the second condition, which will have a difficult runtime?
I am working on some sql that are actually part of FOR LOOP in plpgsql and I could iterate over all the records that exist in my_other_tables and then test under FOR LOOP with some_slow_func (), but I'm curious if sql, or plpgsql supports short circuit.
Some research: I looked at the Postgres mailing lists and found this SQL statement doesn't support short circuiting at all:
http://www.postgresql.org/message-id/ 171423D4-9229-4D56-B06B-58D29BB50A77@yahoo.com
, . , . , , , ? - ?