Subject | SP join issue - (proper subject header this time - sorry) |
---|---|
Author | Gary Benade |
Post date | 2004-09-23T08:19Z |
Hi All
I have a report that uses a SP.
select b.name, b.region, b.orderappend, a.gp gpa, a.turnover turnovera,
a.orders ordersa, a.rank ranka, b.gp gpb, b.turnover turnoverb, b.orders
ordersb, b.rank rankb from
P_GROUP_GP_RANKED('01-feb-2004','14-feb-2004') b join
P_GROUP_GP_RANKED('01-jan-2004','14-jan-2004') a on a.orderappend =
b.orderappend
The above works fine and returns in seconds on huge volumes of data, but
some stores from the FEB period did not exist in the JAN period, so they
don't appear in the data.
I would have thought the following left outer join would solve the problem
...
select b.name, b.region, b.orderappend, a.gp gpa, a.turnover turnovera,
a.orders ordersa, a.rank ranka, b.gp gpb, b.turnover turnoverb, b.orders
ordersb, b.rank rankb from
P_GROUP_GP_RANKED('01-feb-2004','14-feb-2004') b left outer join
P_GROUP_GP_RANKED('01-jan-2004','14-jan-2004') a on a.orderappend =
b.orderappend
... and it does, but only after bogging the server down for up to 15
minutes
and to such an extent that it overheated!
Any ideas on why this is happening and how to get around it?
Water cooling the server is not an option :)
TIA
Gary
I have a report that uses a SP.
select b.name, b.region, b.orderappend, a.gp gpa, a.turnover turnovera,
a.orders ordersa, a.rank ranka, b.gp gpb, b.turnover turnoverb, b.orders
ordersb, b.rank rankb from
P_GROUP_GP_RANKED('01-feb-2004','14-feb-2004') b join
P_GROUP_GP_RANKED('01-jan-2004','14-jan-2004') a on a.orderappend =
b.orderappend
The above works fine and returns in seconds on huge volumes of data, but
some stores from the FEB period did not exist in the JAN period, so they
don't appear in the data.
I would have thought the following left outer join would solve the problem
...
select b.name, b.region, b.orderappend, a.gp gpa, a.turnover turnovera,
a.orders ordersa, a.rank ranka, b.gp gpb, b.turnover turnoverb, b.orders
ordersb, b.rank rankb from
P_GROUP_GP_RANKED('01-feb-2004','14-feb-2004') b left outer join
P_GROUP_GP_RANKED('01-jan-2004','14-jan-2004') a on a.orderappend =
b.orderappend
... and it does, but only after bogging the server down for up to 15
minutes
and to such an extent that it overheated!
Any ideas on why this is happening and how to get around it?
Water cooling the server is not an option :)
TIA
Gary