I want to use multiple pair values for my query to JOIN.
I tried this:
SELECT * FROM tab JOIN
(SELECT 1 as a,2 as b UNION ALL SELECT 3,4) vals WHERE …
There are 2 issues -
- query is limited to ~256 “unions” (can be replaced by a union of unions)
- unions are creating new compiling plans - when I use thousands of queries with this, it is killing cluster
Is there any way, how to solve this. I want to avoid using some temporary table (insert, select, delete) - if it is possible. (MySQL supports something like this: SELECT * FROM (VALUES (1 ,2),(3,4)) t )