I have a fairly common setup, I have a table of tags and record pairs. Querying it is slow so adding an index to the column of the tag I am querying helps speed it up.
tag | site 123 | 456 789 | 101
My question is whether it is beneficial to add an index on both these columns as one index. It will never be selected by the site, so is there any benefit to doing this? I also cannot guarantee that each pairing is unique without making some changes but if I did would this help with performance?
A typical query might look like this:
SELECTsite,tagFROMsitetagsWHEREtag='123' ORtag= '789'