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.

 All Forums
 Other Forums
 SQL Server 6.5 \ SQL Server 7.0
 timeout expired

Author  Topic 

Steel_m
Starting Member

25 Posts

Posted - 2008-11-06 : 09:27:21
Hi Team. Im running a query that includes 2 tables contaning about 1.5 million records each. But i keep getting this error. How do i fix this in order to get my results?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-06 : 09:37:45
analyse the estimated execution plan and see if you've appropriate indexes.
Go to Top of Page

Steel_m
Starting Member

25 Posts

Posted - 2008-11-06 : 10:17:08
well, i didnt specify a primary key intentionally. Would this contribute ? I worked with other tables with less rows without specifying a primary key and they ran pretty fine.
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2008-11-06 : 12:58:49
A primary key is not necessarily your problem, but the lack of a clustered index could impact it. Also, it depends on your statement. Perhaps you have inadvertantly introduced a CROSS JOIN where you are getting the cartesian product, and the more records each table has, the lenght of time goes up exponentially. Perhaps you'd care to post the syntax of your query for our review?

And how long is the process running before you get a timeout? Is it timing out from within Query Analyzer or are you running this from a web application and it is actually the web page that is timing out?

---------------------------
EmeraldCityDomains.com
Go to Top of Page

Steel_m
Starting Member

25 Posts

Posted - 2008-11-06 : 14:02:34
Im running from query analyzer and it prompts me after about 7 seconds.

SELECT
table1.iss_code,
table1.pro_id,
table1.finan_rate_prevailing,
table2.curr_finan_rate_us,
table1.ID,
table1.billing_series,
table1.product_code,
table1.amount_of_additionals,
table1.account_opening_code,
table1.date_activated,
table1.financial_stmt,
table2.delinquency_ind_us,
table2.amount_of_daysdelinquent_us,
table2.expired_finan_rate_us,
table2.sign3,
table2.total_risk_us_billed,
table2.minimum_payment_us_billed


FROM table1 INNER JOIN
table2 ON
table1.iss_code = table2.iss_code
AND
table1.pro_id = table2.pro_id

Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-11-06 : 14:47:50
Do you have indexes on Iss_code and Pro_id? See Execution plan. I hope you are not returing million of rows. Can you set filters so that you get only what you need.
Go to Top of Page

Steel_m
Starting Member

25 Posts

Posted - 2008-11-06 : 15:35:18
no, i didnt set a primary key. And it should return about 1.5 million rows. This is cas table2 simply is an extension of table2. All i am doing is appending selected feilds from table2 to table1.
Go to Top of Page
   

- Advertisement -