I am randomly getting execution timeout expired error using the Entity Framework (EF6). At the time of executing the below update command it gives randomly execution timeout error.

> 
> UPDATE [dbo].[EmployeeTable] SET [Name]=@0,[JoiningDate]=@1 WHERE
>  ([EmpId]=@2)
> 
> 
> 

The above update command is simple and it takes 2-5 seconds to update the EmployeeTable. But sometime the same update query takes 40-50 seconds and leads the error as 

> 
> Execution Timeout Expired. The timeout period elapsed prior to
>  completion of the operation or the server is not responding. the
>  statement has been terminated
> 
> 
> 

.

For that I updated my code inside constructor of **MyApplicationContext** class can be changed to include the following property 

> 
> this.Database.CommandTimeout = 180;
> 
> 
> 

The above command should resolve my timeout issue. But I can’t find out the root cause of that issue.

For my understanding this type of timeout issue can have three causes;

1. There's a deadlock somewhere
2. The database's statistics and/or query plan cache are incorrect
3. The query is too complex and needs to be tuned

Can you please tell me what the main root cause of that error is?