I have a table user_issues
with 3 columns: id
, component_id
and path
and I need to filter it but tuples of component_id
and path
.
So I used the following query in order to achieve this:
SELECT id
FROM user_issues ui
JOIN (VALUES ($1, $2), ($3, $4)) AS v(component_id, path) ON ui.component_id = v.component_id AND ui.path = v.path;
I wonder if there is a more elegant or efficient way of achieving this (instead of using the VALUES
clause to create a set of rows (tuples)).
where (component_id, path) in (($1, $2), ($3, $4))
althoughvalues
may be more efficient (need to check what exactly the query optimizer decides to do in both cases)