Dmitry Tkach <dmitry(at)openratings(dot)com> writes:
> Does btree require a complete order defined?
Yes, absolutely. I do not think that btree is a useful index type for
your problem. Nor rtree (our rtree implementation can only do 2-D
AFAIK).
You might have better luck with GIST. In particular contrib/intarray
would be worth looking at for inspiration. (You could even use it
directly if you cared to change your data representation, I think.)
regards, tom lane