I have a table with three columns, “id”, “letter” and “number”. I have a list of pairs of “letter” and “number”, for which I need to get the “id”s in single query. Obviously, the easy solution is to use n queries, where n is the size of the list.
SELECT id FROM table WHERE number=... AND letter=...
But that requires n queries, in my case it is millions and there is large overhead. Previously, I only had a filter on list of “number”s, so I used
SELECT id FROM table WHERE number = ANY(ARRAY[...])
Is there some syntax that would do what I need, something like
SELECT id FROM table WHERE PAIR[letter,number] = ANY(ARRAY[PAIR[...],...])