Timeout expired. The timeout period elapsed prior to completion of the operation or the server ...

Source: Internet
Author: User

Problem:

The latest program always throws the following exception:

An exception of type ' System.Data.SqlClient.SqlException ' occurred and is caught.

----------------------------------------------------------------------------------

Type:System.Data.SqlClient.SqlException, System.Data, Version=4.0.0.0,culture=neutral, publickeytoken= b77a5c561934e089

Message:timeoutexpired. The timeout period elapsedprior to completion of the operation or the server is not responding.

Source:. Net SqlClient Data Provider ...

...... Database.executereader (Dbcommandcommand) ...

Read Data timeout.

Then went to see the corresponding tables in the database, found that the structure of the table is simple, but the amount of data is very large, there are hundreds of thousands of millions. Look again there is no build indexes/keys, found no, suddenly.


Workaround:

Based on the structure of the table, a Unique key under Indexes/keys isestablished, similar to the following:

ALTER TABLE [dbo]. [Zdata] Add  CONSTRAINT [Ix_zdata] UNIQUE nonclustered ([Pid] Asc,[entryid] asc,[date] ASC) with (pad_index  = OFF, Statistics_norecompute  = off, sort_in_tempdb = off, Ignore_dup_key = off, ONLINE = off, allow_row_locks  = ON, ALLO W_page_locks  = on) on [Primary]go
Test, found much faster and reduced the risk of timeout.





Timeout expired. The timeout period elapsed prior to completion of the operation or the server ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.