How about using a bitlist/bitmap/bitset/bitstring/bitarray, maybe even a compressed one, like roaring-bitsets ?<p>Edit: question: is there any type of index better than compressed bitsets when you have per-column index and you want to AND,OR, basically combine them ?