Is it possible to limit the amount of time SQL Server takes to query a database?
Having the program returning all results that fit the query that it could find in the time frame?
Is it possible to limit the amount of time SQL Server takes to query a database?
Having the program returning all results that fit the query that it could find in the time frame?
Ok, this is my opinion about this question:
Please do not do this to your database. Perhaps you could play with the timeout on a connection level and stream results asap, however... if your database is that big, I guess it's important. Do not abuse your infrastructure like this...
Consider limiting the number of results (SELECT TOP <rows> * FROM ...)
Or use some other sort of (virtual) paging. Again: do not abuse the connection timeout on purpose...
No sql server does this, it's possible to configure a job that will make a kill process with a long lead time, but this is all very wrong. For this use sys.dm_exec_query_stats https://learn.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-exec-query-stats-transact-sql But this is a very wrong tactic
If you're writing a web application for example you can specify command timeout. This will send a kill signal for the query when the timeout expires. The kill signal is not handled immediately by the SQL engine but during the next opportunity.