Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Performance tuning help needed..long running query

$
0
0

Hello Guys,

The following is a long running query where am doing lot of aggregation:

SELECT STG_HOLDINGS.ACCNT_NUM,
  sum(cast(STG_HOLDINGS.SHARES_PER_VAL_QTY as decimal(22,7))), 
  sum(cast(STG_HOLDINGS.MARKET_VAL as decimal(22,7))), 
  sum(cast(STG_HOLDINGS.UNREALIZED_GAIN_LOSS as decimal(22,7))), 
  sum(cast(STG_HOLDINGS.FED_TAX_COST_AMT as decimal(22,7))), 
  sum(cast(STG_HOLDINGS.CURRENT_PRICE as decimal(22,7))),
   sum(cast(STG_HOLDINGS.ANNUAL_PER_UNIT_INCOME as decimal(22,7))),
    sum(cast(STG_HOLDINGS.CURRENT_YIELD as decimal(22,7))),
       STG_HOLDINGS.ASSET_CLASS_NM, 
       sum(cast(STG_HOLDINGS.TOT_ACCNT_MKT_VAL as decimal(22,7)) )
FROM
 STG_HOLDINGS
where 
cast(STG_HOLDINGS.TOT_ACCNT_MKT_VAL as decimal(22,7))<>0
group by STG_HOLDINGS.ACCNT_NUM, 
 STG_HOLDINGS.ASSET_CLASS_NM
 order by STG_HOLDINGS.ACCNT_NUM, 
 STG_HOLDINGS.ASSET_CLASS_NM

Please suggest some tuning tips that i can use.

Please excuse my discussion post and as its 1st post.


  

Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>