Is it possible to make an index for an OR query? I have a query like this:

select * from things where person_1_id=123 OR person_2_id=123


Is it possible to make some sort of index that covers this? Assume that the id (123) matched against will always be the same for both columns.
You could try splitting it into a union and indexing the two individual columns.

Your query would be

SELECT  *
FROM    Things
WHERE   person_1_id = 123
UNION
SELECT  *
FROM    Things
WHERE   person_2_id = 123


and index person_1_id AND person_2_id

Note we use a UNION rather than a UNION ALL so we don't get superflous records

Disclaimer:

I'm more experienced with SQL Server than any other platform, the above method can work in SQL Server but YMMV on other platforms