【发布时间】:2019-10-01 16:47:25
【问题描述】:
我想在 postgres 中做这样的事情
select * from table t where t.one = 11 AND t.two = 12 and t.three = 13
union all
select * from table t where t.one = 21 AND t.two = 22 and t.three = 23
我尝试了join lateral 和inner joins,但性能太差了。所以我需要union all 这些查询,但我不想只是连接不确定数量的这些值,postgres 是否有类似https://stackoverflow.com/a/55484168/1321514 的东西?
【问题讨论】:
-
“这些值的数量不定”是什么意思?哪些价值观,它们来自哪里,以及它们可以以哪些方式变化?如果他们按照您的意愿行事,也许您应该向我们展示您的加入尝试。
-
是的,PostgreSQL 有标准的
unnest。你试过用吗?