Linq to postsgresql operation timeout in linq queries

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
alfrye
Posts: 16
Joined: Wed 05 May 2010 19:39

Linq to postsgresql operation timeout in linq queries

Post by alfrye » Thu 13 Jan 2011 17:31

When running linq query that calls a postgresql store procedure I sometimes a getting a operation timed out error message. I ran the devart dbmonitor when the application is running and noticed that the time out error occurs on the prepare event and the execute event never happens.

If I run the same test and set the datacontext.CommandTimeout to 60 then I do not get the error on the execute. Why is the prepare event taking so long to run. The actual execution of the query seems to be only taking about 10 seconds to run.

I am attaching a copy of the log file from DBMoitor



Code: Select all

using command time out ogf 60 seconds

 1/13/2011 11:41:46 AM 0.125 Prepare: SELECT add_hmi_diagram($1, $2, $3, $4, $5, $6, $7) AS "C1" Complete
  1/13/2011 11:42:41 AM 9.578 Execute: SELECT add_hmi_diagram($1, $2, $3, $4, $5, $6, $7) AS "C1" Error
 

Code: Select all

using default command timeout of 30 seconds

 1/13/2011 11:51:53 AM 31.672 Prepare: SELECT add_hmi_diagram($1, $2, $3, $4, $5, $6, $7) AS "C1" Error

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Fri 14 Jan 2011 12:47

When the PREPARE command is invoked, the statement is parsed and planned. After that, it is only needed to bind the parameters and execute the statement:
http://www.postgresql.org/docs/8.1/stat ... epare.html
Thus, PREPARE may take more time than execution itself.

To disable preliminary preparation of commands, you can set the 'Unprepared Execute' connection string parameter to true or use Protocol 2.0 by setting the Protocol parameter to 2.

Post Reply