Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sql Server Timeout

Status
Not open for further replies.

qwert62

Programmer
Oct 12, 2000
28
0
0
US
I am having a weird situation, Several tables through enterprise Manager will not open to show all records I am getting a timeout. The weird thing is I can open a top N to a point. however if I go one over I get that timeout. Also if I run a select * on this table in Query analyzer It just keeps running with no results. Our machine is a 2GB Ram Dual Processor 1.5 Ghz Cpu Any help would be appreciated. Also I am having Problems Deleting records from some of these tables.
 
This is a guess but I use to have some similar problems. It was due to lack of indexes on the tables and how the transaction log handles data.

I made indexes on all the fields I searched by, plus set up primary keys.

As for deleting a lot of records at a time, the short answer is you can't. Have to do it in small groups. That has to do with the transaction log.
 
I had this problem (using another database - not SQL) maybe my findings can help you.

Either the index is corrupt in which case you can rebuild the index or you have corrupt data in 1 or more rows.

The point that you can open up to is probably where the corruption is or starts.

Try using the DBCC commands (e.g. Reindex, CheckDB, CheckTable) to check the database and table for inconsistencies.

You should also check for viruses.

Hope this helps.
 
Thanks to both replies.

I ended up running an DBCC Indexdefrag, re-indexing the "corrupt" tables and also added a primary key. The combination of these three actions fixed the problem.

Apparently, they frequently add alot of data to these tables and never re-index the tables. This is not a good scenario. To fix this problem, I added a maintenance plan to reindex files weekly.

 
If your indexes are not corrupted, then type the Query in Query Analyizer. Click the and view the query plan that SQL is going to run. If this is a large table and there is a table scan in your query plan, then it may take days to come back. Place a unique clustered index on a unique column and your query will come back in milliseconds as long as your query hits the index. Compound indexes can improve queries that will hit columns other than the unique column.

Good Luck,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top