Does the planner know how to use indices to optimize these queries?
For reference, I was having SEVERE performance problems with the
following comparison in an SQL statement where "mask" was an integer:
"select ... from .... where ...... and (permission & mask = permission)"
This resulted in the planner deciding to run a nested loop and
extraordinarily poor performance.
I can probably recode the application to use a field of type "bit(32)"
and either cast to an integer or have the code do the conversion
internally (its just a shift eh?)
The question is whether the above statement will be reasonably planned
if "mask" is a bit type.
-- Karl Denninger