Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
igerasimov
Starting Member
2 Posts |
Posted - 2011-05-16 : 13:01:05
|
I have two tables with 5,000,000 rows in each and try to run select statement: select c.item_number ,c.lead_storenumber ,r.retail_qty ,r.retail_prc ,r.ao_code ,r.cat_num from dbo.stg_cst_adsi c join dbo.stg_rtl_adsi r on (c.item_number = r.item_num and c.lead_storenumber = r.lead_store) where c.extract_period='201212'I created clustered combined indexes for c.item_number, c. lead_storenumber and r.item_num,r.lead_store.This statement run 7 hours to complete. This is unacceptable. Can you help me to resolve this problem? |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2011-05-16 : 13:33:48
|
7 hours means that query performance is not your (only) problem. There must be other things going on. Does it take seven hours in a query window? Or are you trying to load an application or page with results?If it is NOT a query window then try it there first. If it is fast then you know your problem is outside the database.Be One with the OptimizerTG |
|
|
X002548
Not Just a Number
15586 Posts |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|