moved optimization into the query macro
adding test to identify problem with pushdown and multiple conditions