where x and y and z
or
where y and z and x
Is there a difference in terms of performance and how does the PostgreSQL filter?
Where can I find documentation on this?
where x and y and z
or
where y and z and x
Is there a difference in terms of performance and how does the PostgreSQL filter?
Where can I find documentation on this?
SQL is not a procedural language. The order in which WHERE
conditions appear is completely irrelevant. PostgreSQL will evaluate the whole expression for every row, but decide where and when to apply each expression according to the query plan.
Just make sure that you get the logic straight according to operator precedence.
Just prepend your query with EXPLAIN
and you will see nice information about what planner is really planning.
http://www.postgresql.org/docs/9.2/static/sql-explain.html