|
|
Archives of the TeradataForum
Message Posted: Thu, 03 Oct 2002 @ 11:47:16 GMT
Subj: | | Re: Multiple Views of an Object and the Optimizer |
|
From: | | Claybourne L. Barrineau |
Here is some DDL I put together to illustrate the problem:
BaseFact
ColA
ColB
ColC
ColD
ColE
ColF
Meas1
MultiDim
ColA
ColA1
ColA2
ColA3
ColB
ColB1
ColB2
ColB3
Create ViewDimA
(ColA,ColA1) As
Select ColA, ColA1,ColA2,ColA3 From MultiDim Group By
ColA,ColA1,ColA2,ColA3;
Create ViewDimB
(ColB,ColB1)
Select ColB,ColB1,ColB2,ColB3 From MultiDim Group By
ColB,ColB1,ColB2,ColB3;
Example SQL
Select *
From ViewDimA
, ViewDimB
, BaseFact
Where ViewDimA.ColA = BaseFact.ColA
and ViewDimB.ColB = BaseFact.ColB
and ViewDimA.ColA2 = 'Purple'
and ViewDimB.ColB3 = 'Elephant'
What I would like to happen: Optimizer joins BaseFact to MultiDim (where ColA2 = 'Purple' and ColB3 = 'Elephant') What actually
happens: Optimizer joins BaseFact to ViewDimA (where ColA2 = 'Purple') and then joins resulting spool file to ViewDimB (where ColB3 =
'Elephant')
Thanks for the help,
Clay
| |