PostgreSQL indexing on bit string
First of all: it would be more efficient to store 4 bits of information as separate boolean columns - in every respect: easier to handle, easier to understand and change, easier to index, even smaller storage size! Closely related answer:


Does it make sense to store a couple of Boolean values as array?


To answer your question asked: you can use a partial index like:

CREATE INDEX foo ON tbl (tbl_id)
WHERE bitfield &amp; '0010' = '0010';


&amp; being the bitwise AND operator.
tbl_id being the PK column. (The actual index column hardly matters here.)
In combination with a matching query:

SELECT *
FROM   tbl
WHERE  bitfield &amp; '0010' = '0010';


But your question probably does not reflect your complete situation. There may be better options.