speed problem with a view

joe44

New Member
Hi

I create this view , but when a use it (10min for 20 rows) , it's very slow, if someone know how add indexe in view if it's possible or have other good idee.

Thanks a lot !

CREATE VIEW MATVIEW.ResumSousmi
(QuoteNum, QuoteLine, AssemblySeq, OprSeq, OpCode, qtyPer, LeType, LeCout, LeMin, BrkQty, BrkValue )
AS
SELECT QuoteNum, QuoteLine, AssemblySeq, MtlSeq OprSeq, PartNum OpCode, qtyPer,
'Mater' LeType, EstUnitCost LeCout,
MinimumCost LeMin ,
PBrkQty BrkQty, PBrkCost BrkValue
FROM Pub.QuoteMtl
WHERE Company = 'MAT'

UNION

SELECT QuoteNum, QuoteLine, Assemblyseq, OprSeq, OpCode, qtyPer,
'Setup' LeType, (Number01 - Number01) LeCout,
EstSetHours * SetupBurRate LeMin,
BrkQty, PBrkStdRate BrkValue
FROM Pub.QuoteOpr
WHERE SubContract = 0
AND Company = 'MAT'

UNION

SELECT QuoteNum, QuoteLine, Assemblyseq, OprSeq, OpCode, qtyPer,
'Produ' LeType, ProdBurRate / (ProdStandard + 0.000001) LeCout,
(Number01 - Number01) LeMin ,
BrkQty, PBrkStdRate BrkValue
FROM Pub.QuoteOpr
WHERE SubContract = 0
AND Company = 'MAT'

UNION

SELECT QuoteNum, QuoteLine, AssemblySeq, OprSeq, Opcode, qtyPer,
'SubCt' LeType, EstUnitCost LeCout,
MinimumCost LeMin,
BrkQty, PBrkCost BrkValue
FROM Pub.QuoteOpr
WHERE SubContract = 1
AND Company = 'MAT' ;
 
Top