我正在试着为我的一个朋友解决Netezza的一个问题。我的朋友正在尝试用Netezza做一些非常简单的事情:
select *
from
test
where
ID1 = 12345
and date >= 12/1/2012 and event date <= 12/31/2012
and ID2 in
(x1, x2, ..., x150000)此查询永远不会返回。
在Oracle中,我们可以尝试如下所示:
/*******************************************************************/
/*To reduce the size of the table...*/
create table t_test as
select *
from
test
where
ID1 = 12345
and date >= 12/1/2012 and event date <= 12/31/2012;
/*To make the search on ID2 faster...*/
create index i_ID2 on t_test (ID2);
select *
from
t_test
where
ID2 in
(x1, x2, ..., x150000)
/*Alternative: People say "IN" may be very inefficient at times...*/
select *
from
t_test
where
ID2 = x1
or ID2 = x2
.
.
.
or ID2 = x150000
/*******************************************************************/然而,这在Netezza中是不可能的,因为它没有任何索引概念。
我该如何解决这个问题?
感谢并致以问候
发布于 2015-06-09 03:55:54
试试这条路
select *
from
test
where
ID1 = 12345
and eventdate BETWEEN DATE('12/1/2012') DATE('12/31/2012')
and ID2 in
(x1, x2, ..., x150000)https://stackoverflow.com/questions/14897922
复制相似问题