I am trying to solve a problem in Netezza for a friend of mine. My friend is trying to do something really simple in Netezza:
select *
from
test
where
ID1 = 12345
and date >= 12/1/2012 and event date <= 12/31/2012
and ID2 in
(x1, x2, ..., x150000)
This query never returns.
In Oracle, we could have tried something like this:
/*******************************************************************/
/*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
/*******************************************************************/
However, this is not possible in Netezza, since it does not have any index concept.
How do I solve this problem?
Thanks and regards,