I am having difficulty getting the commandTimeout Property of either a stored proc or TUniTable.
I am setting:
1) FetchAll = false
2) CommandTimeout = 1 //For 1 second.
3) FetchRows = 50000
4)Everything else is default.
The query and spoc clearly execute longer than 1 second as they are selecting all rows from a table with 1 million plus records. The program seems to be ignoring the commandTimeout.
Thanks
commandTimeout
Hello,
I couldn't reproduce this problem.
The UniStoredProc works correctly with the CommandTimeout property.
The CommandTimeout property doesn't affect the fetching time in TUniQuery.
You can't set FetchRows property to 50000 because its range is from 1 to 10000
please send me the following information:
- the exact version of UniDAC.
- the name and version of database server.
I couldn't reproduce this problem.
The UniStoredProc works correctly with the CommandTimeout property.
The CommandTimeout property doesn't affect the fetching time in TUniQuery.
You can't set FetchRows property to 50000 because its range is from 1 to 10000
please send me the following information:
- the exact version of UniDAC.
- the name and version of database server.
Unidac version: 3.00.08
Db: SQL server express 2008
I also have a sample application if needed.
commandtimeout may not be what I really need if it does not affect the fetch time of the query. I am looking for a way to terminate a query if it takes longer than 5 sec to execute. This is because my system does not care about the information if this timely occurs. Each procedure that needs to have a timeout, is placed in it's own thread. Without a timeout, the query could get stuck in a waiting state and thus make my thread unresponsive. I am basically trying to make sure my thread will kill off correctly in a given amount of time regardless of the query execution time.
Db: SQL server express 2008
I also have a sample application if needed.
commandtimeout may not be what I really need if it does not affect the fetch time of the query. I am looking for a way to terminate a query if it takes longer than 5 sec to execute. This is because my system does not care about the information if this timely occurs. Each procedure that needs to have a timeout, is placed in it's own thread. Without a timeout, the query could get stuck in a waiting state and thus make my thread unresponsive. I am basically trying to make sure my thread will kill off correctly in a given amount of time regardless of the query execution time.
Sorry to interject, but i feel like contributing today lol. Feel free to ignore my thoughts if they do not pertain to your issue!
From my experience in working with really long queries..
If you are concerned that a query is taking too long (i imagine it is some obscure report), perhaps optimizing the DB would be a good idea. If it is already optimized, running the query on a separate thread in your application will allow you to develop a responsive "please wait" dialog, or allow the client to continue his work while the query is executed.
For example, if the query needs to be modal, then having a modal dialog containing cancel button (kill the thread) and a label that counts the seconds passed will provide the responsiveness that the customer needs for those longer queries for reports.
Keep in mind that even though the thread is killed or a connection is lost, the query will still continue to run on the server until it is complete, then the changes will be rolled back (if an update/insert/delete is involved).
Anywho, my 2 cents on really long queries for reporting (i've done a few of those!)
From my experience in working with really long queries..
If you are concerned that a query is taking too long (i imagine it is some obscure report), perhaps optimizing the DB would be a good idea. If it is already optimized, running the query on a separate thread in your application will allow you to develop a responsive "please wait" dialog, or allow the client to continue his work while the query is executed.
For example, if the query needs to be modal, then having a modal dialog containing cancel button (kill the thread) and a label that counts the seconds passed will provide the responsiveness that the customer needs for those longer queries for reports.
Keep in mind that even though the thread is killed or a connection is lost, the query will still continue to run on the server until it is complete, then the changes will be rolled back (if an update/insert/delete is involved).
Anywho, my 2 cents on really long queries for reporting (i've done a few of those!)
Thanks for the response. However, my application receives a command from another source and executes that SQL command on the SQL server and responds back to the calling application. To do this I receive the command and spawn a new thread for the execution and response. Most of my SQL executes quickly, however there are time when the SQL does not execute at all and hangs thus creating an infinite thread. I was looking for a way to say, I will only wait n seconds for the query to try to get it's data, if it does not get it in n time then return to the thread and let it exit gracefully instead of hanging in an infinite state.
Any suggestions?
Any suggestions?
Hello,
If the query executes for too long, you can use CommandTimeout property to terminate it. If the fetching process is too long, and query is executed in a separate thread, you can check the fetching process with Fetched or Fetching property. You can terminate its thread if a given time passed, but fetching is not complete. AfterExecute event can be used to detect the end of execution and the start of fetching.
Also you can reduce the FetchRows property value to minimize fetching time.
If the query executes for too long, you can use CommandTimeout property to terminate it. If the fetching process is too long, and query is executed in a separate thread, you can check the fetching process with Fetched or Fetching property. You can terminate its thread if a given time passed, but fetching is not complete. AfterExecute event can be used to detect the end of execution and the start of fetching.
Also you can reduce the FetchRows property value to minimize fetching time.