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
 General SQL Server Forums
 New to SQL Server Programming
 Error Message Please Help

Author  Topic 

Dasman
Yak Posting Veteran

79 Posts

Posted - 2011-07-22 : 17:12:24
Hello,

I am creating some new views. I am dealing with two table each with over half a million records. After a few small view are working fine - I designed a final view that incorporates other views. After every thing is set up and perfect - I get this ERROR Message: "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."

I know its not a server problem because smaller queries work fine. How can I fix this?

Thanks,
Dasman

==========================
Pain is Weakness Leaving the Body.

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2011-07-22 : 22:33:34
Is that error from an application? Can you run this statement in a query window without the timeout? How long does it take and how many rows are returned?

I'm afraid to ask but could you post (all) your view code?

Be One with the Optimizer
TG
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-23 : 03:54:00
analyse the query behind and see if you can spot costly steps. look for absence of index if any

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-07-23 : 05:57:23
That's an application error, not a database error. The application has decided the query took too long and cancelled it.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

Dasman
Yak Posting Veteran

79 Posts

Posted - 2011-07-25 : 12:10:58
Hey Everyone.

So TG - I am running the code in a query window and so far it ahs taken over 3 minutes. I ran a simple DISTINCT query which ran smoothly, so I know the server connection is fine.
In the database connections tabs - I changed the Query Timeout Time to 0 so no timeout time.

I imagine its because the code I am writing is not efficient. I will try to either A - use a CTE at the beginning to make it access less records or B - use a subquery.

I will keep everyone updated. Thanks guys! :)

Dasman

==========================
Pain is Weakness Leaving the Body.
Go to Top of Page

Dasman
Yak Posting Veteran

79 Posts

Posted - 2011-07-25 : 12:20:24
even after 13 minutes - no result showed. The problem was this view structure worked when I told it to only look at 32 records. The problem now is its look at over a million. Im going the subquery route to create a table that only has records I want it to look at.

==========================
Pain is Weakness Leaving the Body.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-07-25 : 12:34:52
Depending how you've written the query, that may help but it probably won't.

Post query, table definitions, index definitions here, if you can find somewhere to upload the execution plan too that would help.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -