我正在尝试左合并子选择给出的两个小表并收到错误消息:
One of the predicates would lead to too big intermediate results. Table date_rabges_table has more than 5000000 rows or is bigger than 5000000 KB
我使用的查询在这里给出:
select
*
from
(
select
date
from
dates_table
where
to_date('2010-01-01') <= date
and
date <= to_date('2014-01-01')
)
left join
(
select
min_date, max_date
from
date_ranges_table
where
i_id = 7
and
j_id = 13
)
on
min_date <= date
and
date < max_date
;
更多细节:
- 第一个子选择只给出一个日期在 2010-01-01 和 2014-01-01 之间的列(我认为它比 1400 个日期多一点)
- 第二个子选择给出了一个有两列和两行的表。
min_date max_date 2013-02-01 2013-05-01 2013-06-01 2013-07-01
我不明白为什么会收到上面提到的错误消息。我正在合并两个很小的表(大约 1400 行,正好 2 行)。left-join 的最终结果不应该大于左边的表。问题出在哪里?