SQl Server 2000 Enterprise:
I have a very poor running view that is a union of a WORK table to it's coorresponding HISTORY table.
Here is the view, if an index can be used, can you detail out the syntax for adding an index to this view. I read that views could be used, but not if your query includes a UNION staement, and this one does. Is that true. If so, what can you recommend to help the performance of this view.
Thank you,
Andrew
______________________
CREATE view aa_GLTrxLineItem as
select a.dex_row_id,a.jrnentry,a.openyear,a.refrence,a.trxdate,(a.debitamt - a.crdtamnt) as TrxAmt,b.actnumst,b.actnumbr_1,b.actnumbr_2
from gl20000 a
inner join Gl00105 b
on a.actindx = b.actindx
union all
select hist.dex_row_id,hist.jrnentry,hist.hstyear,hist.refrence,hist.trxdate,(hist.debitamt - hist.crdtamnt) as TrxAmt,b.actnumst,b.actnumbr_1,b.actnumbr_2
from gl30000 hist
inner join Gl00105 b
on hist.actindx = b.actindx
__________________________________
I have a very poor running view that is a union of a WORK table to it's coorresponding HISTORY table.
Here is the view, if an index can be used, can you detail out the syntax for adding an index to this view. I read that views could be used, but not if your query includes a UNION staement, and this one does. Is that true. If so, what can you recommend to help the performance of this view.
Thank you,
Andrew
______________________
CREATE view aa_GLTrxLineItem as
select a.dex_row_id,a.jrnentry,a.openyear,a.refrence,a.trxdate,(a.debitamt - a.crdtamnt) as TrxAmt,b.actnumst,b.actnumbr_1,b.actnumbr_2
from gl20000 a
inner join Gl00105 b
on a.actindx = b.actindx
union all
select hist.dex_row_id,hist.jrnentry,hist.hstyear,hist.refrence,hist.trxdate,(hist.debitamt - hist.crdtamnt) as TrxAmt,b.actnumst,b.actnumbr_1,b.actnumbr_2
from gl30000 hist
inner join Gl00105 b
on hist.actindx = b.actindx
__________________________________