PostgreSQL Antipatterns: condition evaluation in SQL
SQL is not C++ or JavaScript. Therefore, the evaluation of logical expressions occurs differently, and this is not the same: WHERE fncondX() AND fncondY() = fncondX() && fncondY(). In the process of optimizing the execution plan of the query, PostgreSQL can arbitrarily 'rearrange' equivalent conditions, not evaluate some of them for individual records, relating to […]
