Hi, I have to decide the way to perform a where on a field of a table using bitwise operation. I'll try to explain: I have a table with an indexed int field where I store a code whose value is in a set of power-of-2 codes, i.e. Messages Table IDMessage bigint MessageType int The allowed values of Message Type are pre-defined: 1 - Private Message 2 - Public Message 4 - Broadcast Message 8 - Open Message and so on... Suppose I have to select the rows of type Private OR Broadcast = 1 | 4 = 5 I could do SELECT * FROM Messages WHERE (5 & MessageType) = MessageType or SELECT * FROM Messages WHERE MessageType = 1 OR MessageType = 4 My doubt is: Is the first query efficient? Or does it implies a table scan to perform a bitwise operation for each row in the table? I have absolutely no idea on the effect of such a type of comparison on indexed field... Thank you very much in advance for any elucidation!